Using error_page to a named location - possible?
Ed W
lists at wildgooses.com
Tue Mar 6 22:32:56 UTC 2012
On 06/03/2012 17:47, Maxim Dounin wrote:
>> I can't see that it's possible to use something like:
>>
>> location / {
>> proxy_pass http://127.0.0.1:3000;
>> error_page 502 @502;
>> }
>>
>> location @502 {
>> index /502.html;
>> root /var/www;
>> internal;
>> }
> Try something like:
>
> location @502 {
> internal;
> root /var/www;
> rewrite ^ /502.html break;
> }
>
> This should work at least for GET requests.
Perfect - thanks!
Now, I have thought about this a little while and I don't quite
understand how it works...?
The key seems to be the rewrite clause - near as I can see, without this
the error request gets reprocessed by the "location /" section, but the
rewrite is causing it to terminate that?
Can you teach me to understand this please?
Many thanks!
Ed W
More information about the nginx
mailing list