I've got a proxy set up:
[code]
location ~ ^(.*)$ {
proxy_pass http://127.0.0.1:8080;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header Host $host;
proxy_buffering off;
proxy_read_timeout 3600;
proxy_intercept_errors on;
error_page 500 /50x-running.html;
error_page 404 /404-running.html;
}
[/code]
My problem is, for a specific sub-URI, I want a different error_page directive. In particular, anything starting with /item should have a different error_page. The problem is I still want the proxy directives above applied. I tried:
[code]
location ~ ^/items {
error_page 404 /404-items.html;
}
[/code]
But this simply ignores the proxy directives and shows this 404 always. Likewise if I nest it within the above location directive (which I gather isn't particularly supported anyway). Is there any way, other than creating a new block with the same proxy directives and a different error_page directive, to do this?