Welcome! Log In Create A New Profile

Advanced

Using If Condition

Posted by JackT 
Using If Condition
September 26, 2015 05:35PM
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
Re: Using If Condition
September 29, 2015 02:15PM
You should use Curl, it will show you exactly on each request what is coming back.

---
nginx for Windows http://nginx-win.ecsds.eu/
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 127
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready