20 Commits

Author SHA1 Message Date
Jason
335aeeba2f
Skip sending the proxyReq event when the expect header is present (#1447)
* Skip sending the proxyReq event when the expect header is present

* Adjust padding to match advisory

Co-authored-by: Smylnycky, Jason M <jason.smylnycky@cengage.com>
2020-05-17 17:18:42 -04:00
Jarrett Cruger
4a37175a52 [test] add test for selfHandleRequest and remove modifyResponse as selfHandleRequest is the only way that functionality works 2018-04-20 11:35:07 -04:00
n30n0v
c9a556cfa5 Add followRedirects option 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
Maarten ter Horst
69cf892519 Handle errors for forward request, add test case (#1099) 2016-12-01 09:39:46 -05:00
Deividy Metheler
42df703830 Emit disconnected event instead of error when ECONNRESET (#966)
* Emit disconnected event instead of error when ECONNRESET

ECONNRESET means the other side of the TCP conversation abruptly
closed its end of the connection.

If we get an ECONNRESET error from the proxy request and the
socket is destroyed this means that the client has closed
his connection, and emit this as an error can lead to
confusion and hacks to filter that kind of message.

I think that the best we can do is abort and emit another event,
so if any caller wants to handle with that kind of error, he can
by listen the disconnected event.

https://github.com/nodejitsu/node-http-proxy/issues/813

* code standards, move econnreset check, change ev name
2016-06-03 13:39:40 -04:00
Tobias Bieniek
5c46e4b754 Remove "transfer-encoding" header if "content-length" is set to zero 2016-02-15 15:43:14 +01:00
ashubham
e907d7bb2a end of file line space 2015-03-12 15:17:26 -07:00
ashubham
df158bfc53 added auth header test 2015-03-12 15:11:56 -07:00
Mike Pennisi
8a24a1e18f Set Content-Length header for OPTIONS requests
Web browsers automatically issue an OPTIONS request in advance of other
HTTP requests when the document's domain does not match the target in
order to facilitate Cross-Origin Resource Sharing. These requests are
forbidden from specifying a body and typically do not specify an
(unecessary) `Length` header.

Node.js automatically adds the `Content-Encoding: chunked` header value
to requests that do not specify a `Length` header. This makes proxied
OPTIONS requests from web browsers invalid.

Explicitly set the `Content-Length` header of all `OPTIONS` requests to
"0", disabling the default "chunked" encoding behavior [2].

[1] http://www.w3.org/TR/cors/
[2] http://nodejs.org/api/http.html
2014-11-24 17:14:48 -05:00
Alex Oshchepkov
796ab0bcc5 Added changeOrigin option with test and docs 2014-10-29 07:25:19 +05:00
Manu Sporny
db5f2954b2 [api] Add event-based ability to modify pre-flight proxy requests. 2014-07-18 11:46:04 -04:00
Damian Kaczmarek
7b79a7409a Change name targetTimeout to proxyTimeout 2014-06-10 19:04:12 +02:00
Damian Kaczmarek
0f243516e1 Added targetTimeout option and two tests for timeout 2014-06-10 01:35:53 +02:00
Bryce Gibson
1385635e18 Add a test for the proxyRes event 2014-05-12 08:44:02 +10:00
cronopio
cfd417de23 [tests] fix tests set correct host headers 2013-12-18 12:17:41 -05:00
cronopio
7c72f3b407 [tests] move contributions of @mmoulton to correct place 2013-10-21 21:11:19 -05:00
cronopio
2bf20d61d5 Revert "[tests] fix test to use the new way to pass options"
This reverts commit 52ecd52ee5aa78603e44ba8d5ff9187410351622.
2013-10-21 14:44:49 -05:00
cronopio
52ecd52ee5 [tests] fix test to use the new way to pass options 2013-10-21 03:59:14 -05:00
cronopio
c9f5772fc1 [tests] remove caronte and use http-proxy for file names 2013-10-09 10:49:13 -05:00