Proxy_pass check if 404, and return 404

I am using proxy_pass to a dynamic subdomain:

proxy_pass https://$remote_user.mydomain.io

Is it possible to have the proxy_pass check if the response of
https://$remote_user.mydomain.io is 404, if so, simply do:

return 404;

I.E. don’t proxy, immediately return.

Posted at Nginx Forum:

The only context I can see this being even slightly useful is where
you are concerned about the unacceptably large size of the upstream
server’s 404 page.

If this isn’t your problem, I don’t understand what you’re trying to
solve.

On 7 January 2014 23:57, Jonathan M. [email protected]
wrote:

The only context I can see this being even slightly useful is where
you are concerned about the unacceptably large size of the upstream
server’s 404 page.

If this isn’t your problem, I don’t understand what you’re trying to solve.

Either way, I should have said, look at the error_page directive.

HTH,
J

On Wednesday 08 January 2014 00:10:16 Jonathan M. wrote:

On 7 January 2014 23:57, Jonathan M. [email protected] wrote:

The only context I can see this being even slightly useful is where
you are concerned about the unacceptably large size of the upstream
server’s 404 page.

If this isn’t your problem, I don’t understand what you’re trying to
solve.

Either way, I should have said, look at the error_page directive.

…and “proxy_intercept_errors”.

http://nginx.org/r/proxy_intercept_errors

wbr, Valentin V. Bartenev