Closed Toflar closed 6 years ago
LGTM! Strange that javascript should be cached for a year but fonts only for a month, but I guess we should just rely on html5boilerplate here.
Yeah, my thoughts and arguments were exactly the same :)
On second though, I am not a big fan of this change.
in which case we currently only make sure the rewrites are correct
Which is all that the .htaccess
file should do by default IMHO, because this is the only thing that cannot be preconfigured in Apache.
Your changes are not wrong, however, we should leave it up to the users to decide whether they want to optimize their server through an .htaccess
file. And if they do, they might want to include all of HTML5 boilerplate instead of just a few things.
I guess that is why Symfony does not ship any .htaccess
optimizations, either.
I disagree. This is an absolute must-have to me. It doesn't harm at all and it provides a sane default for a lot of smaller sites and it serves as a reference to copy stuff from if you care.
I don't know what the mime type definition is necessary for (if we wanna keep the file small), but I'd love to have the expire headers set.
Just to ensure the headers are set correctly e.g. on sitemap.xml
files. This is especially important if you set X-Content-Type-Options: nosniff
(what you should) and your server did not set the mime type config accordingly. I think we should keep it, it can reduce issues with compatibility (and again, serve as a reference to copy from).
As discussed in Mumble on March 15th, we should not add this to the default .htaccess
file, because if the server admin forbids to overwrite certain things, it will lead to an internal server error. This is one of the main reasons why we are shipping an .htaccess.default
file in Contao 3.5 instead of an .htaccess
file.
We might ship an .htaccess.default
file instead, although people could use HTML5 boilerplate in this case as well. Also you cannot know that all JavaScript files are cacheable for one year.
use https://github.com/hofff/contao-htaccess instead ;-)
... but we have to update for Contao 4!
It was quite a heated discussion and eventually we agreed on providing an example configuration in the docs and adding a link to it in the .htaccess
file.
A new issue thereto has been created at contao/docs#493.
Ref https://github.com/contao/core-bundle/pull/1404