Markdown negotiation caching (Vary)

Without Vary: Accept, a cache may return the wrong response, sending browsers Markdown instead of HTML.

Standard
Recommended

What it checks

When the page serves Markdown through content negotiation, the same URL returns two different bodies depending on the Accept header. The Vary response header tells caches and CDNs to store them separately.

This check reuses the request made by Markdown content negotiation. If Markdown was negotiated, it looks for Accept in the response’s Vary header. If Markdown was not negotiated, there is nothing to cache separately and the check does not apply.

Results

Status When
Pass Markdown is negotiated and the response includes Vary: Accept
Fail Markdown is negotiated but Vary does not include Accept
N/A The page does not negotiate Markdown

How to fix

Add Accept to the Vary header on every response from a URL that negotiates, both the HTML and the Markdown:

Vary: Accept, Accept-Encoding

Without it, a CDN can serve its cached HTML to an agent that asked for Markdown, or its cached Markdown to a browser.