Skip to content

Added default Expires header and enabled apache served files compression by default. #1615

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

Closed
wants to merge 1 commit into from
Closed

Conversation

miguelbalparda
Copy link
Contributor

Since most of the servers have mod_deflate and mod_expires enabled by default and given the fact that nothing bad can happen if the server doesn't have those mods enabled while wrapping directives between an IfModule, I think it is safe to uncomment the .htaccess directives to enable compression and add default expire headers.
With these directives enabled everything we call "good practices" is covered in a performance test making the site faster to load in subsequent visits.
See https://gtmetrix.com/reports/magetwod.nextmp.net/HytnADQN for history

@joshuaswarren
Copy link

Just wanted to let the M2 team know that this is an issue that is important. A significant majority of the Magento 1 CE sites we take over support for do not have appropriate mod_deflate and mod_expires settings enabled in .htaccess, despite their server having support for it.

Wrapping it in an IfModule removes the possibility that this causes severe issues.

This would help 'out of the box' Magento 2 installations score higher on the Google Pagespeed Insights test and a number of other 3rd-party testing tools.

@hostep
Copy link
Contributor

hostep commented Aug 9, 2015

It also might not be a bad idea to get some inspiration from the server-configs projects for this, since they did a lot of research about tweaking different webservers.

@miguelbalparda
Copy link
Contributor Author

@hostep did you tried the code you mentioned with Magento? What I suggested has been tested in several servers by several devs, I would not recommend adding more changes to this PR to make it simpler and have more chances to be included in the upcoming releases.

@hostep
Copy link
Contributor

hostep commented Aug 10, 2015

@miguelbalparda Yes, we have used part of the server-configs Apache file in more then 20 Magento CE 1.x shops without any problems. We haven't used all the configuration, but most of the stuff underneath 'WEB PERFORMANCE' we used. We do have timestamped assets in our Magento shops, which doesn't work by default in Magento 1.x, but since Magento 2 also uses timestamped assets (I believe?), it will probably work out of the box, or might need a little bit of tweaking on the Expire headers (I haven't had a good look at it yet).

It's a bit silly that the default .htaccess of Magento still checks for Netscape 4.x btw ;)

@vpelipenko vpelipenko added the PS label Aug 10, 2015
@magento-cicd2
Copy link
Contributor

We have automated a Magento Contributor License Agreement verifier for contributions sent to our GitHub projects.
Please see the CLA agreement in the Pull Request comments.

@miguelbalparda
Copy link
Contributor Author

@magento-cicd I just signed the agreement with my github account but it still appears as unsigned.

@miguelbalparda
Copy link
Contributor Author

@piotrekkaminski I'm trying to sign the CLA but it is not working for some reason. I did the complete flow from mobile and desktop and I'm returned here after accepting but the check is still pending.

@miguelbalparda
Copy link
Contributor Author

Any news on this one?

@Vinai
Copy link
Contributor

Vinai commented Dec 10, 2015

We are currently waiting for the travis builds to be fixed before we can continue to process PRs. Sorry for the delay!

@cspruiell
Copy link
Contributor

Are the travis builds still being stabilized?

@okorshenko okorshenko self-assigned this Feb 17, 2016
@sshrewz sshrewz added Progress: needs update Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development labels Feb 25, 2016
@okorshenko
Copy link
Contributor

@miguelbalparda please, reopen this Pull Request, if you have time to stabilize travis builds. Thank you

@miguelbalparda
Copy link
Contributor Author

@Vinai @okorshenko builds are now green, see #4390

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Issue: Ready for Work Gate 4. Acknowledged. Issue is added to backlog and ready for development Progress: needs update
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants