Background: there are good reasons to want to disable
ETag headers for some website assets: to prevent browsers sending conditional requests (either using
If-None-Match, respectively). This is good because conditional requests are just a waste of a round trip for assets that have a version number or digest in the URL – i.e. when you've made a commitment that the URL will always serve the same content body forever. In this case it's often better to force a browser to go straight to its local cache on repeat visits.
My question: I want to host a static website with S3 and CloudFront. It will be fairly low-traffic, and I want it to be fast. But there's no obvious way to prevent these headers coming through to the client – you can't disable them on S3, nor configure CloudFront to strip them out.
Options I've considered:
- put a proxy between S3 and CloudFront (on e.g. EC2) with the sole job of stripping out these headers
- but for me this goes against the whole point of having a static site; I want to minimise moving parts
- use a different CDN that allows you to strip headers (e.g. could do this with Fastly's VCL configuration)
- but I really like CloudFront's zero minimum monthly spend, it makes it very cheap for a low-traffic site.
Is there anything else I could try?