I know that with nginx i can intercept any proxied response codes higher than 300 with:
proxy_intercept_errors on; error_page 404 =200 /;
I would like to do the same thing, but for any response code, specially 200 and make it a 302, but can’t find any.
My use case is that i’m proxying to an API server that returns 200 for cases where access should be denied and 404 when access should be granted. When used along with nginx
auth_request i’m having the opposite behavior so i need to make
404 =200 (so access will be granted, and this can already be done) and
200 =403 (so access will be denied, and this is where i can’t figure it out) to comply with auth_request.