Strange cache behavior with Vary header

I’m seeing a strange behavior regarding Cloudflare’s caching of responses including Vary: Accepts header.

When I access a resource using a subdomain, for example, sub.mydomain.com the cache seems to respect the Vary header, as changing the request’s Accepts header makes the request hit the origin server again, thus creating two cache entries at Cloudflare, but if I access the same resource using a sub path instead, for example, mydomain.com/sub (it’s accessible by both ways), Cloudflare returns whatever was the first thing it cached for that resource, ignoring the headers.

Serving WebP and JPG images in the same URL is impossible when using the later option.

Where I wrote Accepts please read it as Accept. I typed it wrong.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.