I just moved a static site from a VPS to Amazon S3. I have decided to serve only gzipped version of my pages, since S3 is not a webserver I can't have logic based on headers. I also use Cloudfront as CDN.

I was testing my page with http://gtmetrix.com/ and got a bad note because I don't add the vary accept encoding header. So I checked what this is about and as far as I understand it makes sense when we serve both compressed and uncompressed versions.

So I'd like you to help me clarify this. Should I add it? Thanks :)

1 Answer 1


I have decided to serve only gzipped version of my pages

If you're only serving files that you've compressed using gzip, then using Vary: Accept-Encoding will be of no benefit since there won't be uncompressed copies of the files to serve to clients that don't send Accept-Encoding: gzip in the HTTP request. Most clients these days do send this, so you should be fine.

Online website performance tests don't know that you're only serving compressed files, and they're also not fool-proof either. You might note for example that the service you used lists these under a column labeled RECOMMENDATION, so it's wise to follow-up any suggestions like this with some fact-finding (like you did) before becoming too concerned or trying to implement them.

  • I just want to add, that my doubts came from this post: maxcdn.com/blog/accept-encoding-its-vary-important
    – Kev
    Feb 25, 2015 at 9:08
  • You're fine. That article discusses using Vary: Accept-Encoding on the origin server with a CDN. As you indicated, your origin server doesn't provide this, and it's really no longer necessary since according to Google here: All modern browsers support and automatically negotiate gzip compression for all HTTP requests. Therefore they recommend using gzip on all sites. That article (from 2/2013) just states: These days you're unlikely to have clients without compression, but why risk cache mixups?...
    – dan
    Feb 25, 2015 at 9:24
  • 1
    Since you're serving only compressed files though, "cache mixups" (i.e., from uncompressed versions of the same files) wouldn't apply to your situation.
    – dan
    Feb 25, 2015 at 9:28

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.