aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_compress_h.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2024-01-05 15:53:42 +0100
committerLoïc Hoguin <[email protected]>2024-01-05 15:53:42 +0100
commit5b2f600036145653c48a7e8a60853e4a0ecc770b (patch)
tree01ed5b3a36faa666026802356807a53b2805fdca /src/cowboy_compress_h.erl
parent67df6fedaea83b8159fbadbadf460a1f3dd98c51 (diff)
downloadcowboy-5b2f600036145653c48a7e8a60853e4a0ecc770b.tar.gz
cowboy-5b2f600036145653c48a7e8a60853e4a0ecc770b.tar.bz2
cowboy-5b2f600036145653c48a7e8a60853e4a0ecc770b.zip
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.
Diffstat (limited to 'src/cowboy_compress_h.erl')
-rw-r--r--src/cowboy_compress_h.erl3
1 files changed, 3 insertions, 0 deletions
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.