Support » Plugin: Proxy Cache Purge » “pretty permalinks” and WP 4.8?

  • Having absolutely _zero_ luck getting this plugin to function properly with WP 4.8, and the only thing left that I can think of is that the plugin doesn’t like the permalink type my client has selected.

    Problem behavior is that post updates and comments aren’t being shown to non-logged-in users (and I’ve got varnish set to pass through logged in users, so updates and comments show to them without issues). Clearing the varnish cache by either manually restarting varnish or manually issuing purges & bans causes the updates/comments to appear instantly.

    The plugin _appears_ to be functioning properly (it does show a yellow splat for “We did not find Varnish active for this domain,” but I’m assuming that’s because I’m suppressing the X-Varnish header), but I see nothing at all in varnishlog coming through when I trigger the “Empty Cache” button manually or when I create WP posts. If I issue a purge command myself via curl, varnishlog shows the expected output and the manual purges complete successfully. Varnishhist and varnishncsa both show normal activity and cache hit rates are high.

    After a few days of smashing my head against the desk, the only thing I can think of is that I’m using the pre-configured “Post name” setting for permalinks, rather than using “day & name” or “custom.” I think this is causing the problem.

    When I run varnishlog -g request -q ‘ReqMethod eq “PURGE”‘ and try to trigger the plugin by pressing “empty cache,” i see nothing at all in varnishlog. No requests appear. Same for when I post and approve a comment or update a post. No PURGE requests at all show up in the log. And, again, when I issue purge requests manually via curl, the purge requests show up in the log and everythign works great.

    Obviously I can’t keep manually doing this in production, and altering the permalink scheme is not going to fly, either.

    Does anyone have any additional troubleshooting suggestions? If this is indeed the problem, is there anything I can change in the plugin to fix things?

    edit – looks like the reason the plugin thinks varnish isn’t working is because varnish-status.php tries to key on the presence of a “X-CACHEABLE” header, which doesn’t apply to Varnish 4 or 5.

    Varnish 4 is >3 years old. Surely it’s supported…right?

    • This topic was modified 3 years, 7 months ago by leears. Reason: added details
Viewing 9 replies - 1 through 9 (of 9 total)
  • Thread Starter leears

    (@leears)

    For reference, here’s a quick image of the WP4.8 permalink screen and the option I have selected.

    Thread Starter leears

    (@leears)

    Also worth noting that the debug hints on the FAQ don’t work because the varnishlog syntax has changed and “-m” is no longer a valid option.

    Thread Starter leears

    (@leears)

    A bit more info: looks like when I smack the “Empty Cache” button on the dashboard, I get this showing up in varnishncsa:

    
    50.28.11.223 - - [14/Jul/2017:19:50:23 -0400] "GET http://mysite.com/.* HTTP/1.1" 403 162 "https://mysite.com/.*" "WordPress/4.8; https://mysite.com"
    

    That’s the correct public IP address, and I can confirm that that address is part of the correct purge ACL and can purge with curl. When I manually execute curl with a purge command, I can see it match that IP address and respond with a 200 without issue:

    
    *   << Request  >> 655368    
    -   Begin          req 655367 rxreq
    -   Timestamp      Start: 1500076516.448708 0.000000 0.000000
    -   Timestamp      Req: 1500076516.448708 0.000000 0.000000
    -   ReqStart       50.28.11.223 50930
    -   ReqMethod      PURGE
    -   ReqURL         /.*
    -   ReqProtocol    HTTP/1.1
    -   ReqHeader      Host: mysite.com
    -   ReqHeader      User-Agent: curl/7.47.0
    -   ReqHeader      Accept: */*
    -   ReqHeader      X-Forwarded-For: 50.28.11.223
    -   VCL_call       RECV
    -   VCL_acl        MATCH purge "50.28.11.223"
    -   VCL_return     synth
    -   VCL_call       HASH
    -   VCL_return     lookup
    -   Timestamp      Process: 1500076516.448760 0.000052 0.000052
    -   RespHeader     Date: Fri, 14 Jul 2017 23:55:16 GMT
    -   RespHeader     Server: Varnish
    -   RespHeader     X-Varnish: 655368
    -   RespProtocol   HTTP/1.1
    -   RespStatus     200
    -   RespReason     OK
    -   RespReason     Purged.
    -   VCL_call       SYNTH
    -   RespHeader     Content-Type: text/html; charset=utf-8
    -   RespHeader     Retry-After: 5
    -   VCL_return     deliver
    -   RespHeader     Content-Length: 244
    -   Storage        malloc Transient
    -   RespHeader     Accept-Ranges: bytes
    -   RespHeader     Connection: keep-alive
    -   Timestamp      Resp: 1500076516.448795 0.000087 0.000035
    -   ReqAcct        88 0 88 220 244 464
    -   End   
    

    That’s only when I do it manually. Hitting the button yields no activity in varnishlog and only the 403 error in varnishncsa.

    Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Plugin Review Team Rep

    Is that public IP the VARNISH IP?

    They’re not always the same.

    Thread Starter leears

    (@leears)

    Hi Mika—I believe it is, yes. The server in question is running Varnish locally, and has a single public IP address. I am not using Cloudflare or another CDN, so there ought not be any DNS silliness going on.

    Since posting the original thread I’ve also modified the site’s permalink setup from posttitle to to month/posttitle, with no apparent change in the problem behavior, so I don’t think that’s the issue.

    The stack here is HAProxy (SSL termination) to varnish 5, to nginx 1.13.3, with PHP 7 via php-fpm. I’m also troubleshooting this in parallel with another varnish plugin author whose plugin mostly works, but still won’t flush pages when comments are posted/removed.

    I suspect, based on their feedback, that this might simply be due to using Varnish 5 and php7—there might be some incompatibilities with the latest versions of each.

    • This reply was modified 3 years, 7 months ago by leears.
    Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Plugin Review Team Rep

    Varnish 5 … So I haven’t tested on that yet 🙁

    I know. But it’s possible that the per-page flush isn’t being triggered due to a lack of back-compt in varnish 5.

    Php 7 is tested and works fine though.

    Thread Starter leears

    (@leears)

    That sounds reasonable, yep. Varnish 5 should act mostly the same as Varnish 4 (at least from how i’m reading the docs), but there might indeed be basic compatibility issues.

    If there’s anything I can supply—logs, configuration files, anything at all—I’m happy to do so. I’m also fully cognizant that you’re on vacation, and I promise I am not expecting instantaneous support!! Thanks for your attention and responses.

    Plugin Author Ipstenu (Mika Epstein)

    (@ipstenu)

    🏳️‍🌈 Plugin Review Team Rep

    Well I THINK the issue is that the purge command isn’t the same in 4 & 5 as it was in 2 & 3, but you’d have to dig into how that changed and either make an alias in your varnish or possibly send a different request via the plugin. I won’t be able to look till next week though.

    Thread Starter leears

    (@leears)

    Thanks, Mika—I’ll sit tight and see what I can dig up on my own. Will also drop any relevant info here that I get from the other plugin author, if the issue there has a similar resolution. No rush, and again, I appreciate the responses.

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘“pretty permalinks” and WP 4.8?’ is closed to new replies.