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?<div>
<br></div><div>My config looks like this (the variables are replaced before nginx is started):</div><div><div>upstream jsweb {</div><div> server <a href="http://127.0.0.1:8091">127.0.0.1:8091</a>;</div><div> }</div><div>
<br></div><div> server {</div><div> listen $PORT$;</div><div> server_name localhost;</div><div> root $CONTENT_ROOT$;</div><div><br></div><div> location / {</div><div> add_header X-Server-Name "$HOST_NAME$";</div>
<div> proxy_set_header X-Real-IP $remote_addr;</div><div> proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;</div><div> proxy_set_header Host $http_host;</div><div> proxy_pass <a href="http://jsweb">http://jsweb</a>;</div>
<div> error_page 502 503 504 $OUTAGE_PAGE$;</div><div> }</div><div> }</div></div><div><br></div><div>And the errors in the logs look like:</div><div><br></div><div>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: "<a href="http://127.0.0.1:8091/">http://127.0.0.1:8091/</a>", host: "<a href="http://staging.myapp.com">staging.myapp.com</a>"</div>