简体   繁体   中英

Vary: Accept-Encoding header for Amazon S3 hosted site

How do I add a Vary: Accept-Encoding header to the files of a static website hosted by Amazon S3?

This is the only thing keeping me from getting a 100/100 score from Google PageSpeed, I'd love to get this solved!

R

Just to add some perspective, the reason for this is that S3 doesn't currently support on-the-fly compressing, so it's not possible to set this header. If in the future Amazon does add automatic compression, then that header would be set automatically.

With a static site, you're limited to either:

  1. Serving uncompressed assets and having full support, but a slower site/more bandwidth.
  2. Serving compressed assets by compressing them manually, but making the site look like garbage to any browser that doesn't support gzip (there are very few of them now). Note that the extension would still be .html (you don't want to set it to .gz because that implies an archive) but its content would be gzipped.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM