|
9 | 9 | client_max_body_size 400m; |
10 | 10 | client_body_timeout 300s; |
11 | 11 |
|
| 12 | + # If we receive X-Forwarded-Proto, pass it through; otherwise, pass along the |
| 13 | + # scheme used to connect to this server |
| 14 | + map $http_x_forwarded_proto $proxy_x_forwarded_proto { |
| 15 | + default $http_x_forwarded_proto; |
| 16 | + '' $scheme; |
| 17 | + } |
| 18 | + |
| 19 | + # If we receive X-Forwarded-Proto, use it to determine the value of |
| 20 | + # X-Forwarded-Ssl |
| 21 | + map $http_x_forwarded_proto $proxy_x_forwarded_ssl { |
| 22 | + default off; |
| 23 | + https on; |
| 24 | + } |
| 25 | + |
| 26 | + # If we receive X-Forwarded-Port, pass it through; otherwise, pass along the |
| 27 | + # server port the client connected to |
| 28 | + map $http_x_forwarded_port $proxy_x_forwarded_port { |
| 29 | + default $http_x_forwarded_port; |
| 30 | + '' $server_port; |
| 31 | + } |
| 32 | + |
12 | 33 | proxy_http_version 1.1; |
13 | 34 | proxy_set_header Connection ""; |
14 | 35 | proxy_set_header Host $host; |
15 | 36 |
|
16 | 37 | proxy_set_header X-Real-IP $remote_addr; |
17 | 38 | proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; |
18 | | - proxy_set_header X-Forwarded-Proto $scheme; |
19 | | - proxy_set_header X-Forwarded-Ssl on; |
20 | | - proxy_set_header X-Forwarded-Port $server_port; |
| 39 | + proxy_set_header X-Forwarded-Proto $proxy_x_forwarded_proto; |
| 40 | + proxy_set_header X-Forwarded-Ssl $proxy_x_forwarded_ssl; |
| 41 | + proxy_set_header X-Forwarded-Port $proxy_x_forwarded_port; |
21 | 42 | proxy_set_header X-Forwarded-Host $host; |
22 | 43 |
|
23 | 44 | proxy_read_timeout 600s; |
|
0 commit comments