Plugin Contributor
iSaumya
(@isaumya)
Hi @lozguiel,
When you are using the ?swcfpc=1 cache buster query param, your pages are always bypassed from Cache. Now if you are setting cookies at the PHP level then I will highly recommend you not to do it. Cause as soon as you set cookies and there is a set-cookie header in the page response, Cloudflare will not cache that page as it will think that the cookie value might be used inside the webpage to show content dynamically.
Instead, you should use JavaScript. In JS you can either take advantage of LocalStorage API to store things or you can set cookies using JS in both of these cases cache behaviour will not be hampered.
In your current case, if you purge the cache of your entire website and I’m sure you will start seeing the cookie you have added at the PHP level.
That’s brilliant! Thanks very much for your help. I think the JS solution will be perfect 🙂
Plugin Contributor
iSaumya
(@isaumya)
Hi @lozguiel,
Happy to help. 🙂