Request headers that influenced a response should be listed in a
Vary response header.
This tells Unpoly to partition its cache for that URL so that each request header value gets a separate cache entries.
You can set a
Vary header manually from your server-side code. You may also be using
a library like unpoly-rails that sets the
Vary header automatically.
Server-side Unpoly apps may inspect request headers to customize or shorten responses, e.g. by omitting content that isn't targeted. When a response is optimized in that fasion, a
Varyheader should be sent.
The user makes a request to
/sitemap in order to updates a fragment
Unpoly makes a request like this:
GET /sitemap HTTP/1.1
The server may choose to optimize its response by only render only the HTML for
.menu fragment. It responds with the HTTP seen below. Note that it includes a
indicating that the
X-Up-Target header has influenced the response body:
After observing the
Vary: X-Up-Target header, Unpoly will partition cache entries to
That means a request targeting
.menu is no longer a cache hit for a request targeting a different selector.