Can you intercept errors twice? I tried something like the following, but it still serves the nginx 404 page. Is there a better way? server { root /data; error_page 404 = /fetch$uri; location /fetch { internal; proxy_pass http://backend; proxy_intercept_errors on; alias /data; error_page 404 /404.html; } }