Search code examples
varnishvarnish-vcl

tell varnish not to cache requests ending in.html


  1. How can I tell Varnish with the VCL configuration file not to cache any URLs ending in .html. This is for a Magento website and I do not wish to cache any product pages which all end in .html. I thought ?.html or *.html might be the wild card I would need.

  2. Also can I tell Varnish to treat any request for a url ending with the query string ?___from_store=0&___store=ie the same as it would if the query string was not there. So example.com/?___from_store=0&___store=ie would be treated the same as example.com by Varnish.


Solution

  • The wildcard I needed for part one of my questions seems to be .*\.html$

    In my VCL I have

    sub vcl_recv {
    if (req.url ~ "^(/media/|/skin/|/js/|/)(?:(?:index|litespeed)\.php/)?(?:admin|api|.*.html$|cron\.php|checkout|checkout/cart|customer|advancednewsletter|onestepcheckout|onepage|hoi_turpentine|exporter|contacts|iphone|join|sitemap.xml)" ||
    req.url ~ "\?.*__from_store=") {
    return (pipe);
    }
    }