• Resolved mayurjango

    (@mayurjango)


    I really love this plugin but I’m facing a weird problem lately.

    Ever since I moved from PHP-CGI+Apache to PHP-FPM+Nginx, the browsing cache has partially stopped working. That’s apparently because I can’t use .htaccess anymore.

    JS and CSS files no more have browser caching enabled. What’s strange is that images on my site still have a cache policy with cache-control showing max-age=15552000. How’s that possible?

    Note:
    1. I’m not using any other cache plugin.
    2. My hosting doesn’t offer any kind of server-side cache feature yet.
    3. Browsing caching option is enabled in WP Cloudflare Super Page Cache.
    4. Browser Cache TTL is set to “Respect Existing Headers’ in Cloudflare.

    P.S. I also asked my host to add browser caching rules for static assets as specified by you but they can’t do that.

    Please tell what exactly is causing this problem and how I can re-enable browser caching for CSS, JS and font files. Can this be fixed by adding a certain page rule in Cloudflare?

    Thanks in advance.

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

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    Hi @mayurjango ,

    Ever since I moved from PHP-CGI+Apache to PHP-FPM+Nginx, the browsing cache has partially stopped working. That’s apparently because I can’t use .htaccess anymore.

    Exactly. You have to manually add the browser caching rules on Nginx. Under Cache > Browser Caching on plugin settings page, you should see:

    Read here if you only use Nginx: it is not possible for WP Cloudflare Super Page Cache to automatically change the settings to allow this option to work immediately. For it to work, update these settings and then follow the instructions on this page.

    Click on the link and you will find the browser caching rules to add to your Nginx server block.

    The Browser Cache TTL option on Cloudflare must remains on “Respect existing headers” to make page cache working properly.

    Bye!

    Thread Starter mayurjango

    (@mayurjango)

    Hi @salvatorefresta

    Thank you for your response.

    I’m well aware of the instructions mentioned on the plugin settings page.

    My only point is how come browser caching is working for images when it’s disabled for all other static assets?

    Plugin Contributor Salvatore Fresta

    (@salvatorefresta)

    Hi,

    I see a cache-control: max-age=15552000 for the images, so it is not disabled.

    Paste here your nginx config file

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Browser caching isn’t working for JS and CSS files’ is closed to new replies.