1176 Commits

Author SHA1 Message Date
guoxiangyang
e5c02b8a8a add support for modify response 2018-04-20 11:35:07 -04:00
Jake Furler
2c44039a7c issue #953: stop using writeHead
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
2018-04-20 11:35:07 -04:00
Thiago Bustamante
8097ae237e Fix "Can't set headers after they are sent" errors
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
2018-04-20 11:35:07 -04:00
Jarrett Cruger
abf882e03c [dist] update package-lock.json 2018-04-20 11:35:07 -04:00
Gustav Tiger
bab02e909e Include websocket non-upgrade response
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.
2018-04-20 11:35:07 -04:00
n30n0v
c9a556cfa5 Add followRedirects option 2018-04-20 11:35:07 -04:00
Jon Hunter
6f88caf6e4 Add detail about "buffer" option 2018-04-20 11:35:07 -04:00
Radu Serbanescu
d2f9db8241 Add use case for proxy to HTTPS using a PKCS12 client certificate 2018-04-20 11:35:07 -04:00
carpsareokiguess
8231984fb0 fix small typos in README 2018-04-20 11:35:07 -04:00
Jarrett Cruger
81d58c531b [test] for override method feature 2018-04-20 11:35:07 -04:00
Jarrett Cruger
d533a1be43 [dist] document the feature 2018-04-20 11:35:07 -04:00
shaohui.tsh
89f9ef87e0 feat: 添加response自处理参数 2018-04-20 11:35:07 -04:00
Aydin
c5d8466483 Update common.js
Add method parameter to options for overriding the proxy-outgoing HTTP-method
2018-04-20 11:35:07 -04:00
jlaamanen
107c18720c Added timeout option to docs 2018-04-20 11:35:07 -04:00
Jarrett Cruger
de1b80851a [fix] slightly more tolerant 2018-04-20 11:35:07 -04:00
Sean Willis
bc6a23709c Removing unnecessary check since this is a private API 2018-04-20 11:35:07 -04:00
Sean Willis
f5c2381395 Updating docs and adding more tests. 2018-04-20 11:35:07 -04:00
Sean Willis
50f58b4cd9 Forgot 'i' flag when changing from regex shorthand to string. 2018-04-20 11:35:07 -04:00
Sean Willis
2c98416ac2 Adding ability to set cookie path 2018-04-20 11:35:07 -04:00
Jarrett Cruger
543636d0f6 [fix] move badges 2018-04-20 11:35:07 -04:00
Jarrett Cruger
a4bccc332d [dist][test] codecov config 2018-04-20 11:35:07 -04:00
Jarrett Cruger
f4ff1006b9 [wip] proper tests and reporting 2018-04-20 11:35:07 -04:00
Jarrett Cruger
09dcb98456 [dist] make tests work reliably, add package-lock.json 2018-04-20 11:35:07 -04:00
Georgi Yordanov
812757541d Fix overwriting of global options (#1074) 2018-01-02 19:48:17 -05:00
Elad Ben-Israel
c979ba9f2c Update README.md (#1131)
Update link to properties
2017-01-11 15:53:05 -05:00
Jarrett Cruger
e6f24ba617 [fix] rm newline 2016-12-24 17:03:33 -05:00
Ivan Nieto
d73f1ee873 Update README.md with CoC link (#1120)
* Add Code Of Conduct

* Update CODE_OF_CONDUCT.md

Fix placeholder

* Update REAME.md
2016-12-24 17:02:41 -05:00
Ivan Nieto
a539f3cbc1 Add Code Of Conduct (#1119)
* Add Code Of Conduct

* Update CODE_OF_CONDUCT.md

Fix placeholder
2016-12-24 13:27:54 -05:00
Luigi Pinca
d4d85ac5c4 [deps] Update eventemitter3 to version 2.0.x (#1109) 2016-12-16 12:28:52 -05:00
Jarrett Cruger
c1fb596b85 1.16.2 1.16.2 2016-12-06 10:49:02 -05:00
Yuta Shimizu
961f457622 [WIP] Revert default behavior of writeHeaders method (#1104)
* Replace header key only

* Add preserveHeaderKeyCase Option
2016-12-06 09:51:01 -05:00
Jarrett Cruger
ac1a01b1f3 [dist] Version bump. 1.16.1 1.16.1 2016-12-04 10:59:46 -05:00
Kris Williams
8cb451f20c Enable proxy response to have multiple Set-Cookie raw headers #1101 2016-12-04 10:58:49 -05:00
Jarrett Cruger
c252b32f6c 1.16.0 1.16.0 2016-12-02 09:13:10 -05:00
Maarten ter Horst
927357bedc Fix newly introduced error in error handler for ECONNREFUSED in forward proxy (#1100) 2016-12-02 09:09:11 -05:00
Yuta Shimizu
4edbb62cc5 Keep original letter case of response header keys (#1098)
* Keep original letter case of response header keys

* Support node older than v0.11.6

messege.rawHeaders was added in v0.11.6

* Extract duplicated logic to method
2016-12-01 20:03:13 -05:00
Maarten ter Horst
69cf892519 Handle errors for forward request, add test case (#1099) 2016-12-01 09:39:46 -05:00
purificant
2f7f03778c add node 6 to travis 2016-11-29 09:01:06 -05:00
Jarrett Cruger
d8223884f6 1.15.2 1.15.2 2016-10-22 11:47:23 -04:00
Jarrett Cruger
d0f1dfeb82 [fix] style nits 2016-10-22 11:45:16 -04:00
François Leurent
220f5fb795 Expose full callback names 2016-10-22 11:45:16 -04:00
François Leurent
d48f67eb90 Do not rely on func.name (no scope) 2016-10-22 11:45:16 -04:00
François Leurent
61c2889109 Do not rely on func.name (no scope) 2016-10-22 11:45:16 -04:00
François Leurent
fbc266809c With a comment 2016-10-22 11:45:16 -04:00
François Leurent
8eddf45f2a Fix browserification
Browserify fails to resolve the "./http-proxy/" as "./http-proxy/index.js" but as "./http-proxy.js" (so nothing works)
Beeing explicit here does not cost much for http-proxy, yet it's intrinsically complicated for browserify to fix (as trailing slash might be used as a pollyfill shim for native/non-natives addons i.e.  require('url/') vs require('url') )
2016-10-22 11:45:16 -04:00
Niranjan Ojha
f5217d6c20 test case added 2016-10-06 16:24:44 -04:00
Niranjan Ojha
2d01edc5a5 not setting connection header in case of http2 as it is deprecated 2016-10-06 16:24:44 -04:00
Ashish Dahiya
d0a1588639 Add proxy-timeout option to documentation (#1075)
http-proxy provides a [proxyTimeout option](https://github.com/nodejitsu/node-http-proxy/blob/master/lib/http-proxy/passes/web-incoming.js#L122) that allows us to set a timeout on the outgoing socket connection to the target. This timeout is very effective when the upstream target does not respond within an expected time.

I had wasted a few hours searching for this option. Documenting this option can save others a significant amount of time.
2016-10-04 09:54:52 -04:00
Jarrett Cruger
912cd3acae [dist] Version bump. 1.15.1 1.15.1 2016-09-14 17:12:30 -04:00
briman0094
84087208dd Properly write response header optionally including statusMessage (#1061) 2016-09-14 17:08:26 -04:00