Re: передать хидер от между бэкендами

Kruglov Eugenie ekruglov на gmail.com
Ср Янв 13 18:03:06 MSK 2010


X-Accel-Redirect если есть возможность править код бекенда
http://kovyrin.net/2006/11/01/nginx-x-accel-redirect-php-rails/

2010/1/13 Костенко Евгений <nobody.mail at gmail.com>

> Добрый день.
>
> FreeBSD somehost.tld 6.2-RELEASE FreeBSD 6.2-RELEASE #0: Fri Jan 12
> 11:05:30 UTC 2007     root at dessler.cse.buffalo.edu:/usr/obj/usr/src/sys/SMP
>  i386
>
> nginx version: nginx/0.7.64
> TLS SNI support enabled
> configure arguments: --prefix=/usr/local/etc/nginx --with-cc-opt='-I
> /usr/local/include' --with-ld-opt='-L /usr/local/lib'
> --conf-path=/usr/local/etc/nginx/nginx.conf
> --sbin-path=/usr/local/sbin/nginx --pid-path=/var/run/nginx.pid
> --error-log-path=/var/log/nginx-error.log --user=www --group=www
> --with-google_perftools_module
> --http-client-body-temp-path=/var/tmp/nginx/client_body_temp
> --http-proxy-temp-path=/var/tmp/nginx/proxy_temp
> --http-fastcgi-temp-path=/var/tmp/nginx/fastcgi_temp
> --http-log-path=/var/log/nginx-access.log --with-http_gzip_static_module
> --with-http_image_filter_module --with-http_perl_module
> --with-http_realip_module --with-http_secure_link_module
> --with-http_ssl_module --with-http_stub_status_module
> --with-http_xslt_module --with-pcre
>
> Возможно хочется странного, но есть потребность реализовать следующее:
>
> Запрос клиента уходит на back1, где при 404 по error_page уходит в
> именованный location.
> Необходимо сделать rewrite uri на основе хидера, выданного back1.
> Мои попытки свелись к 500й ошибке с сообщением "the rewritten URI has a
> zero length while sending to client".
>
> Вопрос - как подставить хидер, выданный back1 в конструкцию rewrite? Если
> это вообще реально соорудить 8)
>
>       location / {
>             proxy_pass         http://back1;
>
>             proxy_intercept_errors on;
>             recursive_error_pages on;
>
>             error_page 404 = @fetch;
>             <skipped>
>         }
>
>       location @fetch {
>
>             proxy_pass         http://back2;
>             proxy_redirect     off;
>             proxy_intercept_errors on;
>             recursive_error_pages on;
>
>             rewrite ^(.*)$  $SomeHeaderFromBack1 break;
>
>             proxy_set_header   Host             backstore.nodevice.com;
>             proxy_set_header   X-Real-IP        $remote_addr;
>             proxy_set_header   X-Forwarded-For  $proxy_add_x_forwarded_for;
>             <skipped>
>         }
>
>
> --
> С Уважением,
> Костенко Евгений
>
> моб: +7(928)2961142
> icq: 101241013
> jabber: nobody.mail at gmail.com
>
>
> _______________________________________________
> nginx-ru mailing list
> nginx-ru at nginx.org
> http://nginx.org/mailman/listinfo/nginx-ru
>
>


-- 
Faithfully yours, Eugenie
ICQ #701217
GTalk ekruglov at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://nginx.org/pipermail/nginx-ru/attachments/20100113/5fc9d0f8/attachment-0001.html>


Подробная информация о списке рассылки nginx-ru