Hi guys,
I recently deployed a SvelteKit app with adapter-node and noticed my HTTP headers being rewritten. For application/json, Content-Encoding is set to gzip which causes failures in my frontend evaluating the response on POST requests to the node server.
headers: Headers(7) { "content-encoding" → "gzip", "content-type" → "application/json;charset=UTF-8", date → "Mon, 11 Mar 2024 11:58:45 GMT", … }
"content-encoding": "gzip"
"content-type": "application/json;charset=UTF-8"
date: "Mon, 11 Mar 2024 11:58:45 GMT"
"fly-request-id": "01HRPP29M77RCRWN0R71800NZD-ams"
server: "Fly/0637d260 (2024-03-07)"
via: "1.1 fly.io, 2 fly.io"
"x-firefox-spdy": "h2"
I usually do something like response.json()
everywhere in my app resulting in TypeError: Decoding failed.
I conclude from a similar discussion that the proxy sets those header values: Content-Encoding: gzip
Is there anything I can do via the config? Disabling compression (like explained here: Machines · Fly Docs) with
[http_service.http_options.response]
compress = false
did nothing. Overriding the header value like
[http_service.http_options.response.headers]
Content-Encoding = false
results in the frontend not being rendered at all.
I cannot reproduce the issue in my local test environment without manually overriding the header. I also build and test Docker images for production locally before deploying to fly and the issue never occurred there. Is there anything I can do without changing my code?
EDIT: It works perfectly fine for GET requests.