ПРОЕКТЫ 


  АРХИВ 


Apache-Talk @lexa.ru 

Inet-Admins @info.east.ru 

Filmscanners @halftone.co.uk 

Security-alerts @yandex-team.ru 

nginx-ru @sysoev.ru 


  СТАТЬИ 


  ПЕРСОНАЛЬНОЕ 


  ПРОГРАММЫ 



ПИШИТЕ
ПИСЬМА












     АРХИВ :: nginx-ru
Nginx-ru mailing list archive (nginx-ru@sysoev.ru)

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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



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@xxxxxxxxxx>
# 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@xxxxxxxxx
http://mailman.nginx.org/mailman/listinfo/nginx-ru


 




Copyright © Lexa Software, 1996-2009.