Welcome! Log In Create A New Profile

Advanced

Re: nested location + proxy_cache + http/server proxy_hide_header = bug

Maxim Dounin
July 24, 2012 12:14PM
Hello!

On Thu, Jul 12, 2012 at 02:19:21PM -0700, Konstantin Svist wrote:

> Запрос на /index.php; бэкенд возвращает X-Powered-By: PHP...
>
> Конфиг:
>
> proxy_hide_header X-Powered-By; # не работает
> server {
> listen 80;
> proxy_hide_header X-Powered-By; # не работает
> location / {
> proxy_pass http://localhost:1180;
> proxy_hide_header X-Powered-By; # работает
> location ~ \.php$ {
> proxy_hide_header X-Powered-By; # работает
> proxy_cache mycache;
> proxy_set_header Host 'foobar.com';
> }
> }

Патч:

# HG changeset patch
# User Maxim Dounin <mdounin@mdounin.ru>
# Date 1343146145 -14400
# Node ID 964382f88187bb13dab1d21dfc89850be4d45206
# Parent 0f15a7663b9d2ba305d6fb0e304bbd3ce8d32327
Upstream: hide_headers/pass_headers inheritance fix.

Hide headers and pass headers arrays might not be inherited correctly
into a nested location, e.g. in configuration like:

server {
proxy_hide_header X-Foo;
location / {
location /nested/ {
proxy_pass_header X-Pad;
}
}
}

Reported by Konstantin Svist,
http://mailman.nginx.org/pipermail/nginx-ru/2012-July/047555.html

diff --git a/src/http/ngx_http_upstream.c b/src/http/ngx_http_upstream.c
--- a/src/http/ngx_http_upstream.c
+++ b/src/http/ngx_http_upstream.c
@@ -4541,6 +4541,9 @@ ngx_http_upstream_hide_headers_hash(ngx_
if (conf->hide_headers == NGX_CONF_UNSET_PTR
&& conf->pass_headers == NGX_CONF_UNSET_PTR)
{
+ conf->hide_headers = prev->hide_headers;
+ conf->pass_headers = prev->pass_headers;
+
conf->hide_headers_hash = prev->hide_headers_hash;

if (conf->hide_headers_hash.buckets
@@ -4552,9 +4555,6 @@ ngx_http_upstream_hide_headers_hash(ngx_
return NGX_OK;
}

- conf->hide_headers = prev->hide_headers;
- conf->pass_headers = prev->pass_headers;
-
} else {
if (conf->hide_headers == NGX_CONF_UNSET_PTR) {
conf->hide_headers = prev->hide_headers;


Maxim Dounin

_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

nested location + proxy_cache + http/server proxy_hide_header = bug

Konstantin Svist July 12, 2012 05:20PM

Re: nested location + proxy_cache + http/server proxy_hide_header = bug

Albert Mikhaylov July 12, 2012 09:10PM

Re: nested location + proxy_cache + http/server proxy_hide_header = bug

Konstantin Svist July 12, 2012 09:30PM

Re: nested location + proxy_cache + http/server proxy_hide_header = bug

Maxim Dounin July 24, 2012 12:14PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 182
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready