express-http-proxy
express-http-proxy copied to clipboard
Hook to clean proxy.res.headers
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?
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.