How does Fastly Caching know when user session has changed in Magento 2 Commerce

dh1364304172 注册会员
6 days ago

I would recommend reviewing the HTTP response headers as these will indicate to Fastly how to cache the page.

Typically, for content that is unique to individual users, a Cache-Control response header will be sent with a value that indicates to a downstream CDN that the content should not be cached.

Meaning when you log out of one user account and then log into another, the user's account page will be sending something like Cache-Control: private.

Refer to Fastly's documentation for preventing content from being cached.

I would recommend reaching out to support@fastly.com whose customer support team will be able to help debug this for you, but I would imagine this has to do with how Fastly is being instructed to cache the relevant product page.

You should inspect the HTTP response to see if it's being cached by the client (i.e. the user's browser) or by a downstream cache (e.g. Fastly).

You might be able to utilise a Surrogate-Key response header to tag specific product pages and then issue a cache purge for the relevant key.

Fastly doesn't know when the user's session has changed. Fastly is either instructed to serve a page from its cache, or acquires the content from the origin if either the cache is empty or the content has been marked as being 'private' (i.e. unique to a user).

It's likely that specific pages (such as a user's account page) are sent with a Cache-Control: private response header to indicate the content should not be cached.

I'd suggest reaching out to support@fastly.com for the best approach here, but as mentioned above you might be able to utilise a Surrogate-Key.