Maintenance by jcrugzz · Pull Request #1251 · http-party/node-http-proxy

and others added 18 commits

April 19, 2018 13:23
Add method parameter to options for overriding the proxy-outgoing HTTP-method

donasaur

Tigge

When the server do not accept the upgrade request for websockets the
server's response was previously not included and sent back. Now the
proxy will include the response in these cases. Fixes #890.

@jcrugzz

This PR tries to fix "Can't set headers after they are sent" errors.
That are a lot of situations where this error can occurs. In my case, it is happening because I have others middlewares (in an expressjs application that tries to proxy requests). Some of those middlewares (like [passportjs](http://passportjs.org/), or [cors](https://www.npmjs.com/package/cors)) can run ```res.end()``` and when the proxy receive a response, it is already finished.
So, it is necessary to test if we can write on the user response when the proxy response is ready.
I think it could also fix #930, #1168, #908
object.keys in web-incoming.js results in a non-deterministic ordering of keys, which means that in web-outgoing writeHead might be called before setHeader, which throws an error

@guoxiangyang @jcrugzz

…lfHandleRequest is the only way that functionality works

This was referenced

Mar 12, 2021