Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rule for caching #13

Open
Roken120 opened this issue Dec 14, 2020 · 5 comments
Open

Add rule for caching #13

Roken120 opened this issue Dec 14, 2020 · 5 comments

Comments

@Roken120
Copy link

Hello,
Can you add a rule for caching only static file, because he caching all type include php.
Thank

@Roken120
Copy link
Author

And can you add an option for cookie free ? (remove all cookie of assets )

@schoentoon
Copy link

As far as I can tell from the source (and from setting it up myself and using it). It will actually look at the headers from whatever service it proxies whether it should cache it or not. I set it up with nextcloud and it's only caching static assets like js files and images, as it should. Most likely you have your caching misconfigured elsewhere.

@Roken120
Copy link
Author

Roken120 commented Jan 5, 2021

In my website he make cache of php file and broke all. we can not define the ressource extension to caching ?

@unamedplayer
Copy link

unamedplayer commented Feb 5, 2021

I had an issue with PHP, schoentoon is right that simplecache looks at the caching rules of the remote server to decide what to cache and what not to cache. I actually pulled the module they use for this and it seems to interpret caching headers in a funny way (and you can't really blame it because there's a myriad of caching headers who I bet aren't honored the same accross the board).

In any case, I was able to exclude PHP caching on my server (which percolates up to simplecache without having to tweak it). It's already the case but the module simplecache uses needs to see this header: Cache-Control "max-age=0, no-cache, no-store, must-revalidate" no-store is the important one.

I use the following .htaccess to give it absolutely every "no-cache" header one can find in the wild :)

<filesMatch "\.(php)$">
  FileETag None
  <ifModule mod_headers.c>
     Header unset ETag
     Header set Cache-Control "max-age=0, no-cache, no-store, must-revalidate"
     Header set Pragma "no-cache"
     Header set Expires "Wed, 11 Jan 1984 05:00:00 GMT"
  </ifModule>
</filesMatch>

You might need to enable "header" module for Apache if it isn't already. I hope this helps.

@darkweak
Copy link

Hi @unamedplayer if you want a tool with an API which respect the RFC-7234 + Cache-Status and other cool features, take a look at Souin. It will be suported as Træfik plugin asap. Otherwise it works well with traefik (and it's designed to work with) out of the box.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants