spring-projects / spring-projects/spring-framework

Missing ETag response header for CSS TransformedResources

Open
#26,364 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

in: web type: enhancement
Dominant language
Java
Stars
60.2k
Forks
38.8k
Avg merge
5d 2h
Merged PRs (30d)
27

Description

Version: Spring Boot 2.3.4.RELEASE

When using a content resource chain to cache-bust .css and .js files, with server compression enabled, and Thymeleaf as the template engine (not sure if it's relevant or not), the css file is compressed but the js file is not.
If the JS file is requested directly (without going through the resource chain), then it's compressed.

Here's a complete minimal repro: https://github.com/jnizet/compressiondemo

Here's a screenshot of the Chrome network panel when loading the page:

Capture d’écran 2020-09-23 à 18 44 09

As you can see, the bundle.js files (which did not go through the resource chain) has a transfer size that is less than the file size. But the bundle.c525abb....js file, which is the same file, but obtained through the resource chain, is not compressed.

What's weird is that the css file did go through the resource chain, but was compressed as expected.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the linked compressiondemo minimal reproduction and inspect requests for CSS and JavaScript resources served through the content resource chain versus direct requests. Compare compression and response headers, including the missing ETag reported for CSS TransformedResources; done means the transformed JavaScript behaves consistently with the direct resource and the expected ETag header is present.

Written by the indexing model from the issue text.

Assessment

Tech stack
java, spring
Domain
backend, web-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.