Running 'setHeader' during 'proxyReq' event fails for POST requests
Created by: lrettig
Hello,
I'm running into the same issue that happened in #908 which was supposed to have been solved already, but it's occurring for me now on the latest v1.16.2. Trying to do a setHeader
on the passed in proxyReq
for a POST requests fails with:
Error: Can't set headers after they are sent.
It's happening for both node 4.3.2 and 6.1.0.
To reproduce:
proxy.on('proxyReq', function(proxyReq, req, res, options) {
proxyReq.setHeader('origin', 'https://example.com');
});
Thank you.