DEV Community

Discussion on: Real World Developer's Problems: API Versioning

Collapse
 
anduser96 profile image
Andrei Gatej

Could you please elaborate on why using a custom request header makes caching a difficult thing to achieve?

Collapse
 
redfred7 profile image
Fred Heath

Hey Andrei, it's too long to properly describe in a reply but in a nutshell: if we use custom headers we would need to specify these in the Vary HTTP header, so that proxy caches would know where to find the version number, so that they can compose their cache keys. However, content negotiation using the Vary header is notoriously difficult and often leads to cache fragmentation, which is why it's best avoided. bizcoder.com/the-insanity-of-the-v...