From 5b2f600036145653c48a7e8a60853e4a0ecc770b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 5 Jan 2024 15:53:42 +0100 Subject: Don't automatically compress when response has etag In the cowboy_compress_h stream handler. Otherwise this could cause issues with caching, with the etag being the same for compressed/uncompressed content. Users that wish to send etags AND compress will have to do it manually for the time being. --- src/cowboy_compress_h.erl | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src') diff --git a/src/cowboy_compress_h.erl b/src/cowboy_compress_h.erl index 374cb6a..bb4a265 100644 --- a/src/cowboy_compress_h.erl +++ b/src/cowboy_compress_h.erl @@ -96,6 +96,9 @@ check_req(Req) -> %% Do not compress responses that contain the content-encoding header. check_resp_headers(#{<<"content-encoding">> := _}, State) -> State#state{compress=undefined}; +%% Do not compress responses that contain the etag header. +check_resp_headers(#{<<"etag">> := _}, State) -> + State#state{compress=undefined}; check_resp_headers(_, State) -> State. -- cgit v1.2.3