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

Conditionally removing Set-Cookie

$
0
0
I'm trying to implement page caching over WordPress/Woocommerce. It's mostly working. I'm using this as a location block;

location ~ \.php$ {
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_cache WORDPRESS;
fastcgi_cache_valid 60m;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
fastcgi_hide_header Set-Cookie;
}

$skip_cache is set to bypass cache on POSTs and some URLs (ie; checkout, my-account, etc). This works as expected.

My problem is that I'm trying to allow Set-Cookie to pass through on non-cached pages. I've tried using an IF statement (I have read that using IFs can be bad), but I get an error stating that the directive fastcgi_hide_header can't exist here. I've also tried setting a variable an using that instead of hard-coding "Set-Cookie", but it doesn't work either.

How can I conditionally remove Set-Cookie?

Viewing all articles
Browse latest Browse all 4759

Trending Articles



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