Description
Preconditions and environment
Magento 2.4.3-p2 and 2.4.6 for sure. Perhaps other versions too.
- There must be at least two store views configured.
- Multi-store must be set up on a single domain (using cookie)
- Full Page Cache > Caching application should be set to Varnish.
- Varnish configuration is set according to the configuration generated with "Export VCL for Varnish 6"
Steps to reproduce
- Enter a page (let's call it X) that is available on both store views (and URL is the same)
- Switch store to non-default (let's call it B)
- Clear all cache (including Varnish)
- Go to Developer tools and delete "X-Magento-Vary" cookie. Leave other cookies (store etc.) as it is.
- Refresh page
- Try to switch back to default store view (let's call it A)
Expected result
Store view switches back to default store view. The page shows content from store view A (default).
Actual result
You can not switch store view back to default store view on the page you visited.
It works fine on another pages. However this particular page X is being returned from Varnish which (because the lack of X-Magento-Vary cookie) cached store B contents as default (A) (without X-Magento-Vary cookie).
Even if you switch store view to default on another page and then navigate to Page X - store switcher will show invalid store and page content is still wrong.
Additional information
Varnish stores cache according to X-Magento-Vary cookie. If this cookie is missing - Varnish assumes that it is a default store view. However one can make a request without X-Magento-Vary cookie, but still with "store" cookie.
Magento does not validate that, it returns content for specified "store" - but Varnish caches it without X-Magento-Vary.
Then if you visit page with default store view (X-Magento-Vary cookie not present) - Varnish serves you with invalid store view page.
Release note
No response
Triage and priority
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.