Welcome! Log In Create A New Profile

Advanced

Conditionally removing Set-Cookie

Posted by ScorpioTiger 
Conditionally removing Set-Cookie
December 01, 2016 05:06AM
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?
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 164
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready