Vary
header should include Accept
if a resource can be HTML and JSON
#3512
Labels
bug
Something isn't working
Describe the bug
Dynamic pages that can return HTML or JSON (e.g.,
/users/{username}
) should includeAccept
toVary
response header, but they don't.This leads to wrongly cached user profile.
In my case, Cloudflare Tunnel caches a JSON representation for my profile page and returns it for normal browser access (including private browsing with no cookies and no browser caches).
To Reproduce
wget -qS -O https://{domain}/user/{username}
.Vary
header. It isAccept-Language, Cookie
.wget -qS -O https://{domain}/user/{username} --header 'Accept: application/json'
.Vary
header. It is stillAccept-Language, Cookie
.Expected behavior
Vary
header for those pages should includeAccept
header, since it returns different responses for different Accept values (typically for text/html and application/json (or application/activity+json for ActivityPub protocol)).Screenshots
Vary
header:Cloudflare cache issue:
Instance
https://bookwyrm.nops.red/
(I'll purge and workaround the cache issue, so the JSON-returned-to-browser issue will become non-reproducible soon.)
Additional context
N/A
The text was updated successfully, but these errors were encountered: