Welcome! Log In Create A New Profile

Advanced

proxy_read_timeout по GET параметру

cat
October 03, 2012 06:22PM
Приветствую. Хочу сделать proxy_read_timeout отличный от дефолтного для избранных пользователей, у которых начинаются проблемы с клиентом если вдруг бэкенды думают дольше обычного. Пользователь определяется GET параметром. Вот частично рабочий конфиг:

upstream serversInt {
server 127.0.0.1:80;
}

map $arg_user $timeouts {
default normalTimeout;
vasya lowTimeout;
}

server {

listen 127.0.0.1:8080;
error_page 504 =200 @timeoutPage;

error_page 598 = @$timeouts;
location /
{
error_page 504 =200 @timeoutPage;
error_page 598 = @$timeouts;
return 598;
}

location @lowTimeout
{
error_page 504 =200 @timeoutPage;
proxy_read_timeout 1s;
proxy_set_header Host $host;
proxy_pass http://serversInt;
}

location @normalTimeout
{
error_page 504 =200 @timeoutPage;
proxy_read_timeout 5s;
proxy_set_header Host $host;
proxy_pass http://serversInt;
}

location @timeoutPage { return 200 "<timeout/>"; }
}

Работает всё кроме обработки ошибки 504 при срабатывании таймаута бэкенда. Появляется страница с текстом '504 Gateway Time-out' и статусом 504 вместо ожидаемой строки <timeout/> со статусом 200. Хотя в access.log почему-то пишется статус 200.
Subject Author Posted

proxy_read_timeout по GET параметру

cat October 03, 2012 06:22PM

Re: proxy_read_timeout по GET параметру

kron October 05, 2012 07:29AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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