Opened 7 years ago
Closed 7 years ago
#1513 closed defect (invalid)
proxy_set_header in Context: http, server
Reported by: | Owned by: | ||
---|---|---|---|
Priority: | major | Milestone: | |
Component: | documentation | Version: | 1.13.x |
Keywords: | Cc: | ||
uname -a: | Linux esm1.moscow.xxx.ru 2.6.39-400.17.1.el6uek.x86_64 #1 SMP Fri Feb 22 18:16:18 PST 2013 x86_64 x86_64 x86_64 GNU/Linux | ||
nginx -V: |
nginx version: nginx/1.13.4
built by gcc 4.4.7 20120313 (Red Hat 4.4.7-17) (GCC) built with OpenSSL 1.0.2l 25 May 2017 TLS SNI support enabled configure arguments: --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --add-module=/opt/nginx/nginx-rtmp-module-master --add-module=/opt/nginx/nginx-module-vts-master/ --add-module=/opt/nginx/testcookie-nginx-module-master --add-module=/opt/nginx/nginx-upstream-dynamic-servers-master --with-http_image_filter_module --with-http_ssl_module --with-openssl=/opt/nginx/openssl-1.0.2l/ --with-pcre=/opt/nginx/pcre-8.39 --with-http_realip_module --with-http_addition_module --with-http_geoip_module --with-http_sub_module --with-http_dav_module --with-http_flv_module --with-http_mp4_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_random_index_module --with-http_secure_link_module --with-http_stub_status_module --with-http_auth_request_module --with-threads --with-stream --with-stream_ssl_module --with-http_slice_module --with-mail --with-mail_ssl_module --with-file-aio --with-http_v2_module --with-ipv6 --with-debug |
Description
Если использовать proxy_set_header во вне контекста location, заголовок не передается в бекенд.
Хотя в документации сказано, что будет работать.
proxy_set_header X-Forwarded-Proto https;
location / {
#limit_req zone=perserver burst=10;
proxy_pass http://$role;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_intercept_errors on;
error_page 502 503 504 /sorry.html;
error_page 500 /sorry500.html;
}
Note:
See TracTickets
for help on using tickets.
В документации также сказано:
В приведённой конфигурации в
location /
задан свой набор директивproxy_set_header
, соответственно в этом location'е не будут использоваться директивыproxy_set_header
, заданные на предыдущих уровнях.