-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Closed
Description
When hapi only sometimes sets the vary header, based on input headers, it can cause caching issues.
I noticed that this is done for the accept-encoding header here:
Lines 207 to 209 in 26aaff3
| if (request.headers['accept-encoding']) { | |
| response.vary('accept-encoding'); | |
| } |
If a caching agent receives this response to a request without the accept-encoding header, it won't know to re-fetch the resource when another requests is made with the header, thus returning an incorrect response to the client.
The simple fix is to remove the if. Ideally it should only include the vary header for routes that serves different responses depending on the accept-encoding header. Maybe some kind of switch is needed?
Metadata
Metadata
Assignees
Labels
bugBug or defectBug or defect