Skip to content

Commit e7b9056

Browse files
committed
fix nginx header forwarding
1 parent ff68177 commit e7b9056

File tree

2 files changed

+14
-6
lines changed

2 files changed

+14
-6
lines changed

templates/nginx/galaxy.j2

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,21 @@ server {
2828
# The most important location block, by default all requests are sent to gunicorn
2929
# If you serve galaxy at a path like /galaxy, change that below (and all other locations!)
3030
location / {
31-
# This is the backend to send the requests to.
32-
proxy_pass http://galaxy;
31+
# Remove any forwarded headers that clients might have sent
32+
proxy_set_header X-Forwarded-For "";
33+
proxy_set_header X-Forwarded-Proto "";
34+
proxy_set_header X-Forwarded-Host "";
35+
36+
# Set the headers with trusted values
3337
proxy_set_header Host $http_host;
34-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
38+
proxy_set_header X-Forwarded-For $remote_addr;
3539
proxy_set_header X-Forwarded-Proto $scheme;
40+
proxy_set_header X-Forwarded-Host $host;
3641
proxy_set_header Upgrade $http_upgrade;
42+
proxy_set_header Connection "upgrade";
43+
44+
# This is the backend to send the requests to
45+
proxy_pass http://galaxy;
3746
}
3847

3948
location /api/upload/resumable_upload {
@@ -99,7 +108,7 @@ server {
99108
proxy_buffering off;
100109
proxy_set_header Host $http_host;
101110
proxy_set_header X-Real-IP $remote_addr;
102-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
111+
proxy_set_header X-Forwarded-For $remote_addr;
103112
proxy_set_header X-Forwarded-Proto $scheme;
104113
}
105114

templates/nginx/sentry.j2

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@ server {
1313
proxy_pass "http://localhost:9000";
1414

1515
proxy_set_header Host $http_host;
16-
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
16+
proxy_set_header X-Forwarded-For $remote_addr;
1717
proxy_set_header X-Forwarded-Proto $scheme;
1818
proxy_set_header Upgrade $http_upgrade;
1919
}
2020
}
21-

0 commit comments

Comments
 (0)