Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Use if condition with $upstream_http_myheader

$
0
0
Hi Everybody,

First, I hope the question has never been asked ...

I am using NGinx as a reverse proxy and load balancing with upstream.
This is working perfectly, BUT I have to send a return code "404" when a specific header is returned from proxy.

I tried this in my server section :

<code>
location / {
proxy_pass http://myupstream;

if ( $upstream_http_myheader ) {
return 404;
}
}
</code>

This config doesn't work, i'm sure the header is valid because i receive it on client side and the "add_header testheader $upstream_http_myheader" in location section works fine also.

I think the if statement is made before the proxy_pass, but i hope i'm wrong.

Does anybody have a solution for me ?

Best regards,
Ben.

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>