Never cache dynamic file


Is there a way that I can force EasyEngine nGinx not to cache a dynamic WordPress file?

My login pages shouldn’t be cached so that they can be dynamically updated look and feel based on cookies set.

I have tried setting PHP headers in the hope that nGinx would read these and not even cache the response.

Expires: Thu, 19 Nov 1981 08:52:00 GMT Pragma: no-cache

Any way I can do this with PHP headers alone rather than nGinx configuration changes?

Something doesn’t match… EE settings for Nginx ensure dynamic pages never get cached.

Please, provide more information (at least the cache mechanism you are using — or the login URL so we can take a look at the headers, but probably you won’t wish to disclose such information here.

Thanks for your quick reply. I’ve configured EE to use Fast Cache. It’s a WordPress install but has completely bespoke auth pages.

You mentioning this however made me do a little digging. I’ve actually just setup a custom config file with a caching rule which I think will have fixed my issue without changing core nginx files -

cache_rules.conf -

if ($request_uri ~* "(/account/(?:login|resetpw|))/") {
  set $skip_cache 1;

So for anyone with a similar issue this would go in /var/www/[domain]/conf/nginx/cache_rules.conf.

Before restarting nginx (/etc/init.d/nginx restart), run a configtest (/etc/init.d/nginx configtest) to ensure it has been setup correctly and nginx will begin.

Thank you, Chris.