Hacker News new | ask | show | jobs
by acdha 4316 days ago
You're forgetting that Accept headers vary among clients — each non-bit-for-bit identical version will be cached separately. Vary:User-Agent takes that problem and raises it exponentially. You can play games trying to normalize things but that makes life hard using a CDN and increases the risk of buggy proxies creating very hard to diagnose problems.

The alternative of creating unique URLs is incredibly simple and has worked perfectly since the start of the web. Content negotiation is an interesting idea but it's just not worth the support cost.

1 comments

We deliver images out of a CDN where we already have handled the proper request normalization. There is no support cost to implementing content negotiation in this case unless you want to put us behind a proxy. At that point, we can work with you to vary correctly without incurring the complexity you are focusing on.

- Chris

Normalizing the values used in Vary at the CDN level is definitely the right way to go. However, that still leaves problems with transparent proxies at large companies, ISPs, mobile carriers, etc. unless you also have something like Cache-Control:private which is correctly handled.