fastify-static icon indicating copy to clipboard operation
fastify-static copied to clipboard

missing vary header for preCompressed files

Open moonmeister opened this issue 4 years ago • 6 comments

Prerequisites

  • [X] I have written a descriptive issue title
  • [X] I have searched existing issues to ensure it has not already been reported

Fastify version

3.19.0

Plugin version

4.2.0

Node.js version

14.x

Operating system

macOS

Operating system version (i.e. 20.04, 11.3, 10)

11.15.1

Description

The Vary Header is not included when serving preCompressed assets. This can cause issues with caches serving the incorrect version of pages to browsers.

Steps to Reproduce

Serve preCompressed assets and check the header response in devtools and you'll see no vary: content-encoding header present.

Expected Behavior

I'd expect the vary: content-encoding header to be served with all assets. This applies whether or not they werepreCompressed and whether or not the compressed version is served. The MDN article for vary also notes some other times it should be included, like with 304 responses.

related

#158

moonmeister avatar Aug 11 '21 00:08 moonmeister

Would you like to send a Pull Request to address this issue? Remember to add unit tests.

mcollina avatar Aug 11 '21 06:08 mcollina

Should be possible.

moonmeister avatar Aug 11 '21 12:08 moonmeister

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Apr 16 '22 08:04 stale[bot]

Still needs doing.

moonmeister avatar Apr 16 '22 23:04 moonmeister

Probably connected with #300

Uzlopak avatar Jul 17 '22 10:07 Uzlopak

(Obvious) Note: The header is present when static is combined with compress

Note 2: accept-encoding is used more than content-encoding as Vary header

gurgunday avatar Jul 29 '23 11:07 gurgunday