Skip to content

Commit 8521df8

Browse files
Use redirect instead of download to use s3
1 parent 4b3288e commit 8521df8

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

conf/nginx.conf.template

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff 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/"

0 commit comments

Comments
 (0)