• Hello,

    I like very much your plugin, but since the last update version 5.1.0 Purge Cache (All Pages) is not working anymore, although it purges an individual product page when it is changed.
    Here is the VCL purge code that I am using:

        if(req.method == "PURGE") {
            if(!client.ip ~ purge) {
                return(synth(405,"PURGE not allowed for this IP address"));
            }
            if (req.http.X-Purge-Method == "regex") {
                ban("obj.http.x-url ~ " + req.url + " && obj.http.x-host == " + req.http.host);
                return(synth(200, "Purged"));
            }
            ban("obj.http.x-url == " + req.url + " && obj.http.x-host == " + req.http.host);
            return(synth(200, "Purged"));
        }

    Thanks,

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Advisor and Activist

    Support for VCLs is outside what I can really do support on.

    There is an example here – https://github.com/Ipstenu/varnish-http-purge/wiki/purge.vcl

    However that’s for Varnish 6+ I believe. If you’re using an older version, I don’t currently have the means to test deeply there.

    Edit: FWIW the majority of the changes were to add in a ‘limit’ to how many pages get purged with a single-page edit, but that doesn’t impact the regex. I would recommend you start testing with doing the purge manually (i.e. curling purge for a regex flush) and see if that works.

    Thread Starter leomp203

    (@leomp203)

    Hi,

    I think I found the issue/bug.

    I’ve done the regex curling purge, curl -i -X PURGE -H “Host: mydomain.eu” -H “X-Purge-Method: regex” “https://mydomain.eu/.*” and it successfully cleared all the cached pages.

    In the file varnish-http-purge.php the variable $this->the_home_url() is calling the wrong homepage https://mydomain.eu/en/ instead of https://mydomain.eu, due to having the WPML plugin installed, so in this case the command $this->purge_url( $this->the_home_url() . ‘/?vhp-regex’ ); executes $this->purge_url( ‘https://mydomain.eu/en//?vhp-regex’ ); instead of $this->purge_url( ‘https://mydomain.eu/?vhp-regex’ ); which works.

    I had WPML already installed for some weeks, but by coincidence I only enabled the Varnish cache the day I have also updated your plugin, so the issue is not directly connected with your updated but with WPML incompatibility.

    Please, do an update to correct this WPML incompatibility when possible. Meanwhile I will hard code this fix.

    Thanks,

    Thread Starter leomp203

    (@leomp203)

    Hi,

    I have changed this code in the file varnish-http-purge.php and it is working now with WPML. site_url() fetch the website domain without adding the country code at the end. I hope I have not messed up anything.

    public static function the_home_url() {
      //$home_url = apply_filters( 'vhp_home_url', home_url() );
      $home_url = apply_filters( 'vhp_home_url', site_url() );
      return $home_url;
    }
Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Since last update Purge All not working anymore’ is closed to new replies.