villadora / express-http-proxy

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

Fix overwriting userRes headers when using userResHeaderDecorator #548

Open fabb opened 3 weeks ago

fabb commented 3 weeks ago

fixes https://github.com/villadora/express-http-proxy/issues/547

previously, the proxy response would overwrite same-named headers without the possibility to fix it in userResHeaderDecorator. This is problematic e.g. for applications that use set-cookie for auth cookies set in a middleware before the proxy middleware, and where the proxy response overwrites this header.

this change is backwards-compatible and keeps overwriting headers, but when using userResHeaderDecorator, the original headers can be read from userRes and returned to the caller.