From 03978b4f7d48dace6726fa2780f138eab4c75a95 Mon Sep 17 00:00:00 2001 From: Yoshinori Teraoka Date: Wed, 10 Sep 2025 23:09:25 +0900 Subject: [PATCH] Handle 'identity' as a valid Accept-Encoding value Some AWS SDK API requests include the Accept-Encoding header in the signature calculation. Previously, any non-empty Accept-Encoding header was rewritten to `gzip`. This caused a signature mismatch and resulted in an InvalidSignatureException error when the original value was `identity`. The `identity` value specifies that no compression should be used, so it is a valid and supported encoding that should not be changed. This change ensures that the header value is only rewritten if it's not identity, allowing the original value to be used for the signature calculation. --- proxy.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proxy.go b/proxy.go index 03598e0..d3528ae 100644 --- a/proxy.go +++ b/proxy.go @@ -690,7 +690,7 @@ func (p *Proxy) prepareRequest(req *http.Request, session *Session) { req.RemoteAddr = session.ctx.conn.RemoteAddr().String() // Remove unsupported encodings. - if req.Header.Get("Accept-Encoding") != "" { + if req.Header.Get("Accept-Encoding") != "" && req.Header.Get("Accept-Encoding") != "identity" { req.Header.Set("Accept-Encoding", "gzip") } }