Welcome! Log In Create A New Profile

Advanced

Re: Setting an error_page for upstream timeouts

Maxim Dounin
December 23, 2011 07:18AM
Hello!

On Thu, Dec 22, 2011 at 07:59:20PM -0800, Dustin Moskovitz wrote:

> I have a seemingly simple question about configuration, but have been
> unable to find the answer through searching so far. I just want to override
> the default 504 page when the upstream server times out, which I would have
> thought would be handled by the error_page setting. Can anyone help?
>
> My config looks like this (the variables are replaced before nginx is
> started):
> upstream jsweb {
> server 127.0.0.1:8091;
> }
>
> server {
> listen $PORT$;
> server_name localhost;
> root $CONTENT_ROOT$;
>
> location / {
> add_header X-Server-Name "$HOST_NAME$";
> proxy_set_header X-Real-IP $remote_addr;
> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
> proxy_set_header Host $http_host;
> proxy_pass http://jsweb;
> error_page 502 503 504 $OUTAGE_PAGE$;
> }
> }
>
> And the errors in the logs look like:
>
> 2011/12/23 03:50:35 [error] 13736#0: *9 upstream timed out (110: Connection
> timed out) while reading response header from upstream, client:
> 10.214.178.111, server: localhost, request: "GET /-/forgot_password
> HTTP/1.1", upstream: "http://127.0.0.1:8091/", host: "staging.myapp.com"

And what's wrong? Everything looks fine from here: nginx will log
error and return error to client as specified in "$OUTAGE_PAGE$"
(I assume it's something obfuscated or expanded by your
configuration system).

Maxim Dounin

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

Setting an error_page for upstream timeouts

Dustin Moskovitz December 22, 2011 11:00PM

Re: Setting an error_page for upstream timeouts

Edho Arief December 22, 2011 11:22PM

Re: Setting an error_page for upstream timeouts

Dustin Moskovitz December 23, 2011 03:22PM

Re: Setting an error_page for upstream timeouts

Edho Arief December 23, 2011 10:06PM

Re: Setting an error_page for upstream timeouts

Maxim Dounin December 23, 2011 07:18AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

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