Fix overwriting userRes headers when using userResHeaderDecorator#548
Fix overwriting userRes headers when using userResHeaderDecorator#548fabb wants to merge 1 commit intovilladora:masterfrom
Conversation
|
hi @monkpow! unfortunately the existing feature does not solve my use case. I have a server with multiple middlewares that modify the response before the express-http-proxy middleware runs. one of my middlewares sets one or multiple So |
|
you can see the desired behavior in this line of the unit tests of this PR: https://github.com/villadora/express-http-proxy/pull/548/files#diff-3f8141190536852cab9b4717bf9c4113f9e6175d047adf09754347b469d8f820R105 |
fixes #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 useset-cookiefor 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 fromuserResand returned to the caller.