The error_page directive handles nginx problems, whereas proxy_intercept_errors controls whether proxied replies with codes greater than or equal to 300 should be delivered to a client or intercepted and redirected to nginx for processing.
Regardless of the http status code, nginx will return whatever the proxy server returns by default.
proxy_intercept_errors on;
error_page 404 /404.html;