1

I have a redirect in my store that shows a different store view based on the client's location. It reads the header via Fastly and redirects the customer to a different store view using every time the same URL.

When there are many customers accessing the store the cache is mixed, even with the redirect working the cache is distributed to all customers in any location, making customers from the UK see the US store view.

How could I customize the cache block via VCL file to not just redirect by distributing cache based on the location?

asked Feb 14, 2022 at 19:41

1 Answer 1

0

I faced the same issue on varnish in currency switcher. I used the vary header concept to fix this issue. We need to add country code as a vary header, in this way each country generates a separate cached version of the same URL in fastly. We can add a vary header in fastly as well. Refer below links for more details.

https://bilalusean.wixsite.com/magento/post/auto-currency-switcher-based-on-country-code-with-varnish

https://www.fastly.com/blog/best-practices-using-vary-header

https://developer.fastly.com/reference/http/http-headers/Vary/

answered Feb 15, 2022 at 5:55

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.