• Hi,
    I’m using the Cache Inclusions to ensure a lot of my urls that get a lot of traffic with utms get served from cache.
    e.g.

    /^fbclid|pk_(source|medium|campaign|kwd|content)$/

    Problem is, as far as I can see this still relies on php handling the cache inclusions.

    I just noticed this topic https://www.ads-software.com/support/topic/wrong-nginx-recommendations-in-docs/

    and applied that fix to ensure my urls in general are getting served directly by nginx, but my question is, is there any way to write a regex in the nginx config rules that would do the exact same thing without the need for PHP to handle the request?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Anonymous User 16850768

    (@anonymized-16850768)

    If the advanced configuration is implemented so both the advanced cache handling and PHP handling is bypassed, the Cache Enabler settings will no longer be applied as the server is now delivering the cached pages directly. Adding a rule to your server configuration file to replicate this behavior should be possible.

    I don’t have configuration examples for this available at this time, however, I’ll definitely look into what may be possible with our documentation update that is currently in progress.

    ct_roy ? I provided a nginx advanaced cache enabler config for just this to allow caching to handle such query strings at https://community.centminmod.com/threads/ensuring-urls-with-utm-params-fbclid-adwords-params-are-served-from-cache.20253/#post-85825

    hope that helps give you and idea ??

    Thread Starter colmtroy

    (@colmtroy)

    @eva2000 yip it’s ct_roy ?? you are everywhere ??
    Your solution is a super solution if you’re not concerned about utm’s and attribution. So I’ll be using that on some of my sites (thanks again!). But for sites where they need the utm to follow through to the client browser (so GA can pick it up for example), the 302 strips the utms/query params from the url completely and therefore you lose that attribution.

    I was looking at how Runcloud handle this particular problem and they have a nice solution. The obvious difference here is that they’re using fastcgi_cache as the cache store but here’s an example of what they do:
    https://0bin.net/paste/L5yWSjwu#c-kV4L4yVR5qRIT3aI4mOF+EYcBlgf8Ipue1ISJkbrZ

    The utm’s etc. end up being preserved, so I guess I’m wondering if there’s some way with Cache Enabler that we could serve the url from cache but preserve the relevant params rather than redirecting them.

    Interesting that fastcgi_cache solution would work with cache enabler advanced nginx caching too – posted a solution at https://community.centminmod.com/threads/ensuring-urls-with-utm-params-fbclid-adwords-params-are-served-from-cache.20253/#post-85854 that you might want to try. If it works, I can update Centmin Mod’s WordPress Nginx installer’s cache enabler, redis nginx level cache and fastcgi_cache configurations with such too ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Regex Cache inclusions via nginx rules?’ is closed to new replies.