• Resolved scastano

    (@scastano)


    It seems like the plugin does clear the varnish cache properly when I update pages, but it doesn’t work when I update a theme, or even update a product in Woocommerce. Those things I can handle, they’re not a big deal as long as I can purge the entire cache when I’m done making changes.

    However, when I hit the “Purge Varnish” button on the dashboard, WordPress reports the cache has been purged, but in fact, it hasn’t. If I look at my resources in the chrome developer tools, they still show an age that’s increasing and it’s not set back to zero.

    I also seem to get - Debug "VCL_error(200, Purged)" reported from my varnish server.

    Here is what I have for my varnish purge code in my .vcl file as well:

    if (req.method == "PURGE") {
                            if ( !client.ip ~ purge ) {
                                    return (synth(405, "Not allowed."));
                                    }
                            return (purge);
                    }

    I do have my varnish running on another host with nginx in front of it to remove SSL and ha-proxy behind it to load balance over two application nodes.

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

    (@ipstenu)

    ?????? Advisor and Activist

    What version of Varnish are you running?

    Synth implies V4, which isn’t fully supported by the plugin yet.

    “error” 200 is misleading as that’s actually the ‘correct’ message (dude, don’t look at me, I didn’t write Varnish), but My guess here is that you don’t have the regex set up properly OR the IPs aren’t correct.

    What happens when you run curl -X PURGE https://example.com/.* (where example.com is … your domain).

    Thread Starter scastano

    (@scastano)

    Yeah, Varnish is a little weird for sure, but yes… I am running version 4. Version 4.0.3 to be exact on Ubuntu 14.04 with nginx 1.10.1 in front of it to strip off SSL and haproxy behind it to load balance between my two wordpress and DB nodes.

    As for the IPs, I think they’re correct because if I put in IPs that DON’T match I do exactly get an error and it tells me it can’t be done and with the right IPs in there, from the varnish log I see the “matched localhost” entry… which is odd, since it’s not the localhost, but it does work. Including when I edited a single page.

    If I run the curl command from either of my wordpress nodes I get the following. I’m running “varnishlog | grep -i purge” to minimize the huge output, but in response I get:

    -   ReqMethod      PURGE
    -   VCL_acl        MATCH purge "localhost"
    -   VCL_return     purge
    -   VCL_call       PURGE
    -   Debug          "VCL_error(200, Purged)"
    -   RespReason     Purged

    On the wordpress node I ran the curl from, I get:

    <!DOCTYPE html>
    <html>
      <head>
        <title>200 Purged</title>
      </head>
      <body>
        <h1>Error 200 Purged</h1>
        <p>Purged</p>
        <h3>Guru Meditation:</h3>
        <p>XID: 87</p>
        <hr>
        <p>Varnish cache server</p>
      </body>
    </html>

    So that would seem to me like it works, no? But then, when I just checked the homepage of my site, the initial request shows in the response headers that the page is still has Age: 2770 in it which seems to indicate that varnish in fact did NOT purge the whole site.

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    So my default warning – The plugin DOES NOT support Varnish 4 right now.

    I’m aware of how annoying that is. But that actually is the problem here. the purge command doesn’t work on your server, and I can’t make that work since that’s what the plugin is looking for.

    If curl -X PURGE https://example.com/.* doesn’t work, the plugin won’t either ??

    Is it not possible to use banning instead of purging? That would work in any version of Varnish

    Plugin Contributor Ipstenu (Mika Epstein)

    (@ipstenu)

    ?????? Advisor and Activist

    It is possible, but it just hasn’t been done yet given that I don’t actually have unlimited time and availability. Pull requests as welcome on Github though.

    https://github.com/Ipstenu/varnish-http-purge/

    Ok, I found out a solution that doesn′t need to change the plugin code.

    This is the thread in the Varnish mailing list:

    https://varnish-cache.org/lists/pipermail/varnish-misc/2017-August/026083.html

    and the article that shows it:

    https://info.varnish-software.com/blog/step-step-speed-wordpress-varnish-software

    I found that article in this article where a warmer plugin is mentioned:

    https://michaelshadle.com/projects/varnish-http-purge-warmer

    Hope this helps others

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Purge Varnish button on dashboard doesn’t work.’ is closed to new replies.