POST requests in my app fail when using gzip compression and HTTP/2, any other requests are working fine.
Requests fail with a vague error, and i am not sure how to debug it.
ERR_HTTP2_PROTOCOL_ERROR 200 (OK)
Example of failing request
'https://some.domain/api/route1/route2' \
-H 'accept: application/json, text/plain, */*' \
-H 'accept-language: en-GB,en-US;q=0.9,en;q=0.8' \
-H 'cache-control: no-cache' \
-H 'content-type: application/json' \
-H 'cookie: some cookies' \
-H 'language: en' \
-H 'origin: https://some.domain' \
-H 'pragma: no-cache' \
-H 'referer: https://some.domain' \
-H 'sec-ch-ua: "Google Chrome";v="123", "Not:A-Brand";v="8", "Chromium";v="123"' \
-H 'sec-ch-ua-mobile: ?0' \
-H 'sec-ch-ua-platform: "macOS"' \
-H 'sec-fetch-dest: empty' \
-H 'sec-fetch-mode: cors' \
-H 'sec-fetch-site: same-origin' \
-H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/123.0.0.0 Safari/537.36' \
-H 'x-domain: some.domain' \
--data-raw '{"ids":"319743"}'
Response headers
Content-Encoding: gzip
Content-Type: application/json; charset=utf-8
Date: Wed, 27 Mar 2024 07:29:26 GMT
Expect-Ct: max-age=0
Server: nginx/1.20.1
Strict-Transport-Security: max-age=15552000; includeSubDomains
Strict-Transport-Security: max-age=31536000; includeSubDomains; preload
Strict-Transport-Security: max-age=31536000; includeSubdomains;
Vary: Accept-Encoding
X-Content-Type-Options: nosniff
X-Dns-Prefetch-Control: off
X-Download-Options: noopen
X-Permitted-Cross-Domain-Policies: none
X-Xss-Protection: 0
Also, when performing this request with curl, it only fails with flag --compressed
* We are completely uploaded and fine
< HTTP/2 200
< server: nginx/1.20.1
< date: Wed, 27 Mar 2024 07:30:56 GMT
< content-type: application/json; charset=utf-8
< x-dns-prefetch-control: off
< expect-ct: max-age=0
< strict-transport-security: max-age=15552000; includeSubDomains
< x-download-options: noopen
< x-content-type-options: nosniff
< x-permitted-cross-domain-policies: none
< x-xss-protection: 0
< vary: Accept-Encoding
< content-encoding: gzip
< strict-transport-security: max-age=31536000; includeSubDomains; preload
< strict-transport-security: max-age=31536000; includeSubdomains;
<
* HTTP/2 stream 1 was reset
Can you, please, help me to understand how to debug or fix this issue?
I searched here for similar questions, but they didn't help me. I tried to turn off response compression for this domain in my BFF node server, but they are still compressed by nginx over which I have no power
UPDATE: I've managed to turn off compression, it was only on my side and everything works now. But what HTTP/2 doesn't like about compression?