ostark / upper

Integrates Edge Caches like Fastly, KeyCDN, Cloudflare and Varnish with Craft.
MIT License
102 stars 22 forks source link

Surrogate Keys are briefly added then removed after publishing a Draft in a Section. #54

Closed taylordaughtry closed 2 years ago

taylordaughtry commented 3 years ago

Hi! I'm having an issue with keys inexplicably disappearing after a few seconds—but only when using the Fastly driver.

I can't seem to reproduce it with the Dummy driver, so before I setup a Fastly install just to repro it locally + get more specific I wanted to open an issue here and see if something sounds familiar/similar to anything you've seen previously.

Generally, here's what's happening:

  1. Given a Section with a few Entries displayed at /blog
  2. Create/Publish/Delete an Entry/Draft within the Section
  3. I briefly see the surrogate key for that Section in the Surrogate-Key header when I send a curl (or in-browser) request to /blog
  4. However, after a few seconds, I can send that same curl command, and the key for that section is no longer there

Based on what's happening, I'd imagine it's related to one of the purge jobs, but it doesn't make sense that it'd be clearing removing keys from the page. Of course, if you need anything else just let me know! Also happy to record my screen + send that, if it helps.

Environment information:

taylordaughtry commented 3 years ago

@ostark Hi! Just wanted to ping you on this one; have you had the chance to check this out just yet?

ostark commented 3 years ago

hi @taylordaughtry

Fastly strips the Surrogate-Key headers by default before delivering the response to the client: https://developer.fastly.com/reference/http/http-headers/Surrogate-Key/#debugging

It's not documented, but I can imagine that they will strip them only on cache HIT, not on cache MISS.

Oli