Vary header not respected?

After trial and error when using workers fetch, it seems that cloudflare ignores the origin server’s vary header when it caches the response.
Is this a bug or by design?
If by deign - is there an explanation why?
Is there some workaround for it? Perhaps using the cache API?

This is by design, and is relatively common in CDNs.

What are you trying to do? There may be other solutions to get the same result.

2 Likes

by design Cloudflare CDN Cache To Support HTTP Vary Header

I’m using workers to call my origin server.
Part of what the worker does is adding some custom headers like x-something, which affect the way the origin server works.
I ended up adding these headers also as query params (which the origin server ignores) just to make CF consider it as part of the cache key. Luckily I had this relatively simple solution, but I don’t think it’s always possible to use this technique.
So I must say this seem all wrong. Vary is part of HTTP standard so I’m not sure why CF ignores it.