PHP code example of elgentos / magento2-varnish-extended
1. Go to this page and download the library: Download elgentos/magento2-varnish-extended library. Choose the download type require. 2. Extract the ZIP file and open the index.php. 3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
elgentos / magento2-varnish-extended example snippets
# Remove all marketing get parameters to minimize the cache objects
if (req.url ~ "(\?|&)(/* {{ tracking_parameters }} */)=") {
set req.url = regsuball(req.url, "(/* {{ tracking_parameters }} */)=[-_A-z0-9+(){}%.]+&?", "");
set req.url = regsub(req.url, "[?|&]+$", "");
}