Skip to content

proxy issues with accept-encoding (zstd) #2880

Description

@wug-ge

Environment

Node v22.1.0
[email protected]

Reproduction

Create new Project, add the following to nitro.config.ts:
routeRules: { "/api/**": { proxy: "https://jsonplaceholder.typicode.com/**" }, },

Describe the bug

I'm not sure what reproduces this, but it seems to be affected by some kind of race condition given the result is not always the same.

When I call http://localhost:3000/api/todos/1 with this setting, I get back

502 Bad Gateway
Bad Gateway

at createError (./node_modules/h3/dist/index.mjs:78:15)
...

or a 200 response with some kind of encoded string/binary data? (see attached screenshot)
image

In my tests, it seems to be happening ONLY with https requests, http requests work fine.

Additional context

Let me know if you need any more information.

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingh3

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions