By cloudnine
We put our Magento site on Sucuri and it is much slower than running it off our own server. Looking further, we notice that Apache is sending two Vary: Accept-Encoding headers and, as per Sucuri support, these duplicate headers are preventing the site from being cached properly by Sucuri CDN.
Here’s the curl output:
curl -IL https://domain.com
HTTP/1.1 200 OK
Server: nginx
Date: Mon, 26 Jun 2017 15:21:07 GMT
Content-Type: text/html; charset=UTF-8
Connection: keep-alive
Vary: Accept-Encoding |------> First header
Set-Cookie: frontend=fotji70ieh366b5k165u3mcd63; expires=Mon, 26-Jun-2017 16:22:19 GMT; Max-Age=3600; path=/; domain=domain.com; HttpOnly
Expires: Mon, 26 Jun 2017 18:22:19 GMT
Cache-Control: public, max-age=10800
Last-Modified: Wed, 14 Sep 2016 07:13:12 GMT
Set-Cookie: frontend_cid=sugOUAWt3WMknsbW; expires=Mon, 26-Jun-2017 16:22:19 GMT; Max-Age=3600; path=/; domain=domain.com; secure; httponly
X-Frame-Options: SAMEORIGIN
Strict-Transport-Security: max-age=31536000
Vary: Accept-Encoding,User-Agent |------> Second header
X-Content-Type-Options: nosniff
X-XSS-Protection: 1; mode=block
X-Sucuri-Cache: MISS
X-Sucuri-ID: 16007
I have gone nuts trying to figure out why these duplicate headers are occurring. I removed mod_deflate and mod_expires <IfModule> declarations from the Apache vhost and Magento’s .htaccess but the duplicate headers are still showing up.
I would greatly appreciate any pointers towards fixing this. Thanks in advance.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
This question was answered by @cloudnine:
Just figured out the answer, finally! Magento’s .htaccess had this additional <IfModule> declaration that was causing the second Vary: Accept-Encoding header:
<IfModule mod_mime.c> AddEncoding gzip svgz </IfModule>Commenting it out did the trick.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.