express-http-proxy icon indicating copy to clipboard operation
express-http-proxy copied to clipboard

Hook to clean proxy.res.headers

Open davidsteinberger opened this issue 6 years ago • 1 comments

I'm faced with a server that responds invalid header data.
copyProxyResHeadersToUserRes() copies all headers over and throws an exception. I did not find a way to intercept that (note decorateUserResHeaders() runs after, the exception happens during the copy into res).

Is there a way to to modify the raw response before copyProxyResHeadersToUserRes()is run?

davidsteinberger avatar Jul 26 '18 11:07 davidsteinberger

You're right, there is no elegant way to handle this today. You could probably check in the skipToNextHandler, and throw back to your express 500 handler (or whatever is next()), but I'm guessing this does not match your use case.

This seems like a reasonable workflow step to add; it might take a little while for this to rise to the front of my priority level, but I'm happy to accept a patch for a feature that lets you modify/verify the proxy response before acting on it.

monkpow avatar Aug 06 '18 17:08 monkpow