Welcome! Log In Create A New Profile

Advanced

Re: Как узнать response content type?

Вадим Лазовский
December 20, 2012 05:56AM
Здравствуйте.

Директива if - часть ngx_http_rewrite_module. ЕМНИП, все обработчики этого
модуля вызываются до начала работы с upstream. Поэтому в данном контексте
конструкция if не имеет смысла, так как nginx еще не передал запрос на
backend.


20 декабря 2012 г., 10:27 пользователь F1restorm <nginx-forum@nginx.us>написал:

> Maxim Dounin Wrote:
> -------------------------------------------------------
> > Hello!
> >
> > On Wed, Dec 19, 2012 at 10:09:13AM -0500, F1restorm wrote:
> >
> > > Как сделать работоспособной следующую конструкцию? Нужно показывать
> > разные
> > > страницы ошибок в зависимости от content type из response.
> > >
> > > location / {
> > > if ($response_content_type = application/xml) {
> > > error_page 5xx /error_5xx.html;
> > > }
> > > }
> > >
> > > Переменная $content_type содержит значение от request и не подходит.
> > > Переменной типа $response_content_type не нашел.
> >
> > Как вы собираетесь узнать Content-Type ответа до того, как
> > выберете, какой именно ответ послать?
>
> Я хочу узнать Content-Type ответа бэкэнда, а не Content-Type ответа
> пользователю. Клиент обращается к nginx, nginx перенаправляет запрос на
> бэкэнд, бэкэнд отвечает кодом ошибки. В этот момент я хочу узнать
> Content-Type ответа бэкэнда и в зависимости от него ответить пользователю
> той или иной страницей с описанием ошибки.
>
> >
> > --
> > Maxim Dounin
> > http://nginx.com/support.html
> >
> > _______________________________________________
> > nginx-ru mailing list
> > nginx-ru@nginx.org
> > http://mailman.nginx.org/mailman/listinfo/nginx-ru
>
> Posted at Nginx Forum:
> http://forum.nginx.org/read.php?21,234203,234218#msg-234218
>
> _______________________________________________
> nginx-ru mailing list
> nginx-ru@nginx.org
> http://mailman.nginx.org/mailman/listinfo/nginx-ru
>



--
Best Regards,
Vadim Lazovskiy
_______________________________________________
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru
Subject Author Posted

Как узнать response content type?

F1restorm December 19, 2012 10:09AM

Re: Как узнать response content type?

Maxim Dounin December 19, 2012 10:22AM

Re: Как узнать response content type?

F1restorm December 20, 2012 01:27AM

Re: Как узнать response content type?

Вадим Лазовский December 20, 2012 05:56AM

Re: Как узнать response content type?

Maxim Dounin December 20, 2012 07:34AM

Re: Как узнать response content type?

Andrey Repin December 20, 2012 12:06PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 260
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