1

I'm just testing on the Google platform and have a a couple Nginx VM's behind an LB set up which caches to GCDN globally. I want to bypass the cache for users that are logged in (with a wordpress cookie).

What is the best strategy for this? Up until now I've been using VM's -> Varnish -> Cloudflare and bypassed Varnish's cache based on the cookie. I wrote some workers code to do the same for Cloudflare. However, with GCDN/GLB there seems to only be functionality for sticky sessions/cookies which isn't applicable for what I need to do.

I can obviously use nginx to detect the cookie and set Cache-Control: no cache headers to prevent caching but if the pages are already in the cache that boat has sailed. Any advice is appreciated here, cheers.

Raynel A.S
  • 225
  • 1
  • 4
d1ch0t0my
  • 25
  • 5

1 Answers1

1

In this case, when there is a Set-Cookie header, Google CDN will not cache the response. This being said, you’re right that if the URL is already on Cloud CDN, the request most likely won’t hit your Backend and the response will be given by Cloud CDN. I say most likely as there are other values that affect Cacheability in Cloud CDN.

Currently, if the URL is already in cache, you need to invalidate the cache first.

For different scenarios, you can double check the options to prevent Cloud CDN caching here.

All this being said, if you really want to have a Feature, which will allow you to take in considerations users already logged in. I may suggest you to open a Feature Request using the following link.

Thanks

Raynel A.S
  • 225
  • 1
  • 4