File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed
Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -246,7 +246,17 @@ http {
246246
247247 # Handle "/builds/" location to keep backward compatibility with the
248248 # previous artifacts implementations.
249- #
249+ # CLI clients (curl, wget, aria2c — no "Mozilla" in User-Agent) fetching
250+ # a file are internally rewritten to /redirect/ so they receive a presigned
251+ # URL and download directly from S3. Browser clients keep the original
252+ # proxied-through-nginx behaviour (/download/).
253+ # Directory listings (trailing slash) always go to /download/.
254+ #
255+ set $builds_backend "/download/";
256+ if ($http_user_agent !~* "Mozilla") {
257+ set $builds_backend "/redirect/";
258+ }
259+ rewrite ^/builds/([^/]+/.+[^/])$ $builds_backend$1 last;
250260 rewrite ^/builds/(.*)$ /download/$1 last;
251261
252262 # Handle subdir listing under "/redirect/"
You can’t perform that action at this time.
0 commit comments