GzipFilter: Weaken ETag when gzipping by tsawada · Pull Request #13818 · playframework/playframework

Pull Request Checklist

Purpose

This PR updates GzipFilter to weaken strong ETags when compressing a Result.

If the Result contains an unquoted ETag, which is malformed according to RFC 9110, Section 8.8.3, GzipFilter removes the ETag header entirely.
I think this behavior is the safest fallback to prevent any downstream caching issue with invalid headers. It seems Cloudflare handles malformed ETags this way, according to their documentation.

https://developers.cloudflare.com/cache/reference/etag-headers/#important-remarks

You must set the value in a strong ETag header using double quotes (for example, etag: "foobar"). If you use an incorrect format, Cloudflare will remove the ETag header instead of converting it to a weak ETag.

I believe this improves adherence to the HTTP standards.