Fix Magento 2. cookie and webp image issues
Budget: $30 – $250 USD
I have had the diagnostics done by Amasty in reference to their page speed image mode and received the following
According to our dev team, currently .webp images aren't displayed on the storefront due to Varnish peculiarities, as well as the absence of required Magento cookie. Varnish caches a page only once, and then it is fetched to all website visitors, no matter they're logged in or not, not depending on the headers sent in their requests, and so on, which also concerns .webp support. To avoid such situation when .webp images aren't fetched at all, Varnish normally uses a Magento cookie called X-Magento-Vary, which helps determine when .webp images should be sent if customer's browser supports .webp images.
Per developers' research, such cookie is absent on your instance, as well as the header where it should be transferred:
https://screens.amasty.com/16045152.png
https://screens.amasty.com/16044910.png
Due to that, as the cookie doesn't explicitly allow using .webp images, to avoid showing .webp images to a customer whose browser might not support .webp, the system doesn't show .webp images:
https://screens.amasty.com/16043354.png
Task is to fix Magento cookie X-Magento-Vary, and ensure webp images are created
According to our dev team, currently .webp images aren't displayed on the storefront due to Varnish peculiarities, as well as the absence of required Magento cookie. Varnish caches a page only once, and then it is fetched to all website visitors, no matter they're logged in or not, not depending on the headers sent in their requests, and so on, which also concerns .webp support. To avoid such situation when .webp images aren't fetched at all, Varnish normally uses a Magento cookie called X-Magento-Vary, which helps determine when .webp images should be sent if customer's browser supports .webp images.
Per developers' research, such cookie is absent on your instance, as well as the header where it should be transferred:
https://screens.amasty.com/16045152.png
https://screens.amasty.com/16044910.png
Due to that, as the cookie doesn't explicitly allow using .webp images, to avoid showing .webp images to a customer whose browser might not support .webp, the system doesn't show .webp images:
https://screens.amasty.com/16043354.png
Task is to fix Magento cookie X-Magento-Vary, and ensure webp images are created