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

Using If Condition

$
0
0
I am trying to removed all cookies from response headers if Pragma: no-cache is not present in the headers in Nginx. I am trying to achieve this as below

if ( $sent_http_pragma !~* "no-cache"){ more_clear_headers "Set-Cookie*";
break; }
if ( $sent_http_cache_control !~* "no-cache"){ more_clear_headers "Set-Cookie*";
break; }

The if condition here fails and the cookies are cleared for everything, even if the condition is not satisifed, but the header is present. Also tried using map as

map $sent_http_pragma $pval{
"~.* no-cache" 1;
}
map $sent_http_cache_control $ccval{
"~.* no-cache" 1;
}

but always getting default blank value. Appreciate any help in this regards.

Thanks

Viewing all articles
Browse latest Browse all 4759

Trending Articles



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