I am attempting to create a fallback for my error_page. Principally, the logic ought to be one thing like the next
load foobar.html > doesn’t exist on distant server -> load 404.html from distant server to indicate 404 web page -> doesn’t exist on distant server – > load 404.html on native filesystem.
I’ve the next, and loading each localhost/404.html and localhost/international404.html works, however after I break localhost/404.html (by eradicating the file from the http server) it doesn’t present the worldwide404.html web page as I might anticipate.
server {
hear 80;
server_name instance.com www.instance.com;
proxy_intercept_errors on;
location / {
proxy_pass http://localhost:3000;
proxy_set_header X-Actual-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
error_page 404 /404.html;
}
location /404.html {
proxy_pass http://localhost:3000/404.html;
error_page 404 /international404.html;
}
location /international404.html {
root /usr/share/nginx/html;
}
}
The above works effective after I hit http://localhost/404.html (when the 404.html file is on distant server it reveals that, after I delete it, it hundreds the worldwide404.html file). Nonetheless, after I sort a non-existent web page I simply get the default nginx 404 web page.