Closed Toflar closed 6 years ago
I generally like the idea, but didn't we agree in https://github.com/contao/manager-bundle/pull/58 not to have caching defaults in the .htaccess file? If images already have a long caching period in the server configuration, these lines would be useless and unnecessary to parse…
Default configuration generally has no caching headers at all. And these lines are everything else but "useless" because assets/images
can be cached for 1 year. files/whatever
cannot. So your general caching setting would certainly not be 1 year but a lot lower.
Well it was 1 month in your previous PR (https://github.com/contao/manager-bundle/pull/58/files#diff-384ec441f8200771c47307a594c0d63eR141), which we could not know either. Just saying…
In this case we know that we can cache for 1 year. So it's not "useless" and this PR has nothing to do with the other one at all. Just saying...
I generally like the idea, but didn't we agree in #58 not to have caching defaults in the .htaccess file?
We sure did and to me this is the same case.
we agreed on providing an example configuration in the docs and adding a link to it in the
.htaccess
file.
Can we have that up for discussion again? It‘s a really bad idea not to provide sensible defaults.
If you really want another heated discussion, here you go. However, the arguments have not changed at all, so expect the same conclusion as last time.
As discussed in Mumble on July 5th, we did not come to the same conclusion as last time. 😄
Soo... we get defaults? 😁
RTM
Just to summarize for everybody why this PR was accepted, contrary to the other one:
assets
(because as of 4.6 everything there contains versioning or is called using a version string) and bundles
(same here). It does not automatically add any headers on e.g. files in files
or anywhere else..htaccess
should be ignored if you configure everything on Apache config level and for nginx this is out of scope anyway. Also just a note for anybody: If you really do care about all this stuff. Make sure your provider supports stuff like mod_pagespeed
that will automatically optimize a lot for you and use tools such as Cloudflare and Co.
This PR is mainly just a simple improvement for smaller sites that don't have any of those tools.
Thank you @Toflar.
All our thumbnails contain hashes so the files can be cached forever by the clients as in case it is updated, the path will change. I think it would be a great addition to automatically add the caching headers so everything inside
assets/images
is cached forever (aka 1 year).