villadora / express-http-proxy

Proxy middleware for express/connect
Other
1.22k stars 236 forks source link

Unable to remove default charset from "content-type" response header #539

Closed ssafayet closed 1 month ago

ssafayet commented 4 months ago

I am using express-http-proxy to proxy requests to a Next application. The issue is, that express-http-proxy is modifying response header "content-type" that is being set by the Next server and adding a "charset=utf-8" by default. Is there any way to prevent this behavior and pass specific response headers as it is to the client without modifications? It is breaking Next's SPA behavior.

I think This file is causing behavior particularly this line:

res.set(item, rsp.headers[item]);

Express is setting the charset by default as it seems.

monkpow commented 1 month ago

Hi @ssafayet,

Take a look at this section in the README. I think this should cover your use case.

I'm going to close this as answered, but feel free to re-open if you want to continue the conversation.