Welcome! Log In Create A New Profile

Advanced

Проблема с обработчиком error_page в именованном location

Michael Plostak
April 13, 2010 08:00PM
Помогите выставить свой error_page для именованного location (nginx/0.7.64).

В приведенной ниже конфигурации, для событий проходящих мимо @nocached
корректно выдается index_error.html в ответ на ошибку 503, а вот для
попадающих в него - отвечает встроенный обработчик nginx.

Максимум что удалось нагуглить похожего -
http://www.ruby-forum.com/topic/141251, к сожалению не помогло.

---
С уважением,
Михаил.

P.S.: значимая часть конфига:

server {
listen aaa.bbb.ccc.ddd:80;
server_name some.server.name;
error_page 500 502 503 504 /index_error.html;

location = /index_error.html {
root /somewere/www;
}

location / {
proxy_pass http://172.20.0.3:80/;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
}

location @nocached {
error_page 500 502 503 504 /index_error.html;

proxy_pass http://172.20.0.3:80;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
access_log /var/log/nginx/nocache.log cache;
}

location = / {
proxy_pass http://172.20.0.3:80;
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For
$proxy_add_x_forwarded_for;
access_log /var/log/nginx/cache.log cache;

if ($is_args) { return 412; }
if ($cookie_user) { return 412; }
if ($request_method = POST ) { return 412; }
error_page 500 502 503 504 /index_error.html;
error_page 412 = @nocached;
proxy_cache news1;
proxy_cache_key "$request_method|$host|$request_uri";
proxy_hide_header "Set-Cookie";
proxy_ignore_headers "Cache-Control" "Expires";
proxy_cache_valid 200 301 302 304 5s;
proxy_cache_valid any 3s;
proxy_cache_use_stale updating;
}


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

Проблема с обработчиком error_page в именованном location

Michael Plostak April 13, 2010 08:00PM

Re: Проблема с обработчиком error_page в именованном location

Maxim Dounin April 13, 2010 08:54PM

Re: Проблема с обработчиком error_page в именованном location

Michael Plostak April 13, 2010 11:12PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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