You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Add Vary:Accept header to thumbs responses - #1335
Thumbs info.json responses now send Vary: Accept-Encoding, Accept. Previously they sent only Vary: Accept-Encoding.
Why
When the request path has no /v2/ or /v3/ segment, Thumbs picks the IIIF Image API version from the Accept header (ThumbsMiddleware.DiscoverRequestedImageApiVersion). For v2, Accept also decides whether the Content-Type is application/ld+json or application/json.
Thumbs has UseResponseCaching() enabled with ResponseCacheSeconds: 60 (set in the base appsettings.json). ASP.NET's response cache stores a separate copy for each value of the headers listed in Vary. With only Accept-Encoding listed, it served whichever version was requested first to every client for 60s.
Confirmed live on prod: requests with */*, the v2 profile and the v3 profile all returned v2 with the same x-correlation-id, so they were one cached response. With the cache bypassed, the v3 request returned v3. This happens on both apex and CloudFront. CloudFront keys on Accept correctly, but on a miss it fetches from Thumbs and gets the cached response.
Orchestrator's description-resource endpoints (image info.json, single-item manifest, named query) already send Vary: Accept-Encoding, Accept via IIIFAssetControllerBase, and were confirmed working live.
Changes
Thumbs/ThumbsMiddleware.cs: add Accept to the Vary header in WriteInfoJson.
Tests: assert Vary contains Accept in the Thumbs InfoJsonTests (v2 direct path, v2 conneg, v3 conneg) and in the Orchestrator ImageHandlingTests v2/v3 conneg info.json tests, which weren't covered before.
After deploying
Nothing to clear: Thumbs' cache holds responses for 60s, so any wrong copies expire within a minute.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this change?
Resolves #1336
This PR enables thumbs info json responses to send
Vary: Acceptheaders, which was missed