Download the PHP package creativestyle/magesuite-vary-cookie-signer without Composer
On this page you can find all versions of the php package creativestyle/magesuite-vary-cookie-signer. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download creativestyle/magesuite-vary-cookie-signer
More information about creativestyle/magesuite-vary-cookie-signer
Files in creativestyle/magesuite-vary-cookie-signer
Package magesuite-vary-cookie-signer
Short Description X-Magento-Vary Cookie Signer
License OSL-3.0
Homepage https://creativestyle.de
Informations about the package magesuite-vary-cookie-signer
Motivation
Magento uses special cookie called X-Magento-Vary
to distinguish between different variants of some pages (eg. PDP page for customers with special discount).
When varnish server is used this is handled by adding content of X-Magento-Vary
cookie to hash key.
This can be abused to bypass varnish page cache and generate high load on php server by generating random value for every request.
This extension provide a way to verify valid cookie on varnish server by providing extra cookie called X-Magento-Vary-Sign
containing sha1 hash of X-Magento-Vary
cookie content and signing key (which should be random value).
Without knowing secret, attacker isn't able to generate correctly signed cookie and we can verify it on varnish server and ignore incorrect values, therefore reuse cached page.
Magento configuration
Edit the /app/etc/env.php file to configure the signing key.
Varnish configuration
You need to install uplex vmod_blobdigest also available as RPM in mageops repository.
Make sure you have those imports at the beginning of your VCL:
Add to sub vcl_init
Add to sub vcl_recv
NOTE: First if statement can only fail when update
is called after finish
, but this is not possible, however VCL do not allow calling object methods, therefore this function mainly as workaround to this limitation.
Do not forget to replace REPLACE_THIS_WITH_SIGNING_KEY
with your unique random string, and make sure you use the same value in varnish and magento.
https://creativestyle.atlassian.net/wiki/spaces/MGSDEV/pages/2359951361/VaryCookieSigner+optional