152 Commits

Author SHA1 Message Date
Alistair Jones
402ab05734 Pass HTTPS client parameters.
For more detailed control over HTTPS client behaviour, pass through the
parameters listed here:
http://nodejs.org/api/https.html#https_https_request_options_callback

The `rejectUnauthorized` parameter is omitted, because it overlaps with
the existing `secure` parameter:
https://github.com/nodejitsu/node-http-proxy/blob/master/README.md#using-https

Conflicts:
	test/lib-http-proxy-common-test.js
2014-12-17 10:09:29 -07:00
Jarrett Cruger
ea0a4ded80 [fix] style spacing wtf 2014-12-17 00:53:51 -07:00
Jorge Leal
c62610e8e4 Deprecated proxySocket event in favor to open event.
Maintained both proxySocket and open for backward compatibility.

Conflicts:
	test/lib-http-proxy-test.js
2014-12-17 00:52:19 -07:00
Jorge
26537866b3 [api] add close event in ws-incoming.js 2014-12-17 00:51:06 -07:00
Jarrett Cruger
c04485671a [fix] use simple regex instead of indexOf to check the protocol to support without the colon fixes #711 2014-12-08 23:04:23 -05:00
Jarrett Cruger
501e8c2a9b [fix] properly include port in host header with changeOrigin in all cases fixes #750 2014-12-08 16:14:16 -05:00
Jarrett Cruger
9c0b8697bc [fix] fix #738 2014-12-02 10:25:46 -07:00
Jarrett Cruger
d98d9516ea [fix] simple fixes #748 #744 #746 2014-12-02 09:58:06 -07:00
koolc
70ed1c4273 [Bugfix] Allow for multiple ? in outgoing urls.
Without this fix urls that had multiple ? in them would drop sections
of the url since before there was an assumption of there only being one.
2014-12-01 12:34:16 -05:00
Jarrett Cruger
8d68ac0e0f [fix] be defensive and ensure location is in headers before running url.parse() 2014-11-25 17:22:23 -05:00
Jarrett Cruger
48ae5d828c [minor] style consistency 2014-11-25 17:21:24 -05:00
Jarrett Cruger
95a588706b Merge pull request #741 from samccone/sjs/redirect-host-rewrite
Allow optional redirect host rewriting.
2014-11-25 17:08:54 -05: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
Sam Saccone
daf66a7a88 Allow optional redirect host rewriting. 2014-11-23 19:22:07 -05:00
Ricky Miller
84036e9ddd style changes 2014-11-13 06:05:32 +09:00
Ricky Miller
daa2ce0ee3 copy headers instead of referencing them so they don't unexpectedly get overwritten 2014-11-13 04:37:45 +09:00
jleal52
9ba8311343 Updated to support error callback on proxy.web and start/proxyReq/end continue working. 2014-11-12 14:41:46 +00:00
Jarrett Cruger
3f19e6e178 [minor] this shouldnt be in var block 2014-11-11 11:47:15 -05:00
Jarrett Cruger
7c5e40a429 [fix] style changes 2014-11-10 23:02:43 -05:00
Ricky Miller
4a2b870cc9 do not modify the query string 2014-11-09 08:44:22 +09:00
Ming Liu
d1eabccf93 websocket needs to respect options.secure too 2014-11-04 15:06:45 -08:00
Alex Oshchepkov
796ab0bcc5 Added changeOrigin option with test and docs 2014-10-29 07:25:19 +05:00
MinRK
c62766391e close socket if upstream request fails
adds socket.end() to on('error') handlers for proxyReq and proxySocket
2014-09-30 19:58:57 -07:00
MinRK
bcd8a564a8 close websocket if proxyReq is closed before upgrade
avoids leaving client sockets open when upstream
connections are rejected.
2014-09-30 17:01:20 -07:00
Jarrett Cruger
10a294af4d [fix] do a check to make sure the server exists before we try and emit 2014-09-30 15:22:52 -04:00
Thorsten Lorenz
000eb533de emitting proxySocket on proxyServer
- emitted once proxySocket was created and socket was piped into it
- needed to support sniffing messages coming from proxy target
2014-09-29 20:09:46 -04:00
Jarrett Cruger
e7d50b1a37 [minor] extra space 2014-09-25 22:11:12 -04:00
Jarrett Cruger
c0a796b3e3 [fix] perf optimization so we have a precompiled regexp 2014-09-17 07:53:18 -04:00
MinRK
65a21bce6d use regex to check for upgrade header
in websocket connections
2014-09-16 12:07:15 -07:00
MinRK
51eeebef68 handle 'upgrade' in comma-separated connection header
Firefox sends `keep-alive, upgrade`, not just `upgrade`,
which the proxy incorrectly turned into `close`
2014-09-16 11:15:17 -07:00
Arnout Kazemier
73e8a4cdd5 [minor] Added missing JSDoc comments 2014-09-12 19:21:12 +02:00
Samuel Reed
73d865bc9f Fix breaking bug on url joining resulting in paths like ///path.
Added OS-agnostic url join helper.
2014-09-12 13:08:10 -04:00
Jarrett Cruger
ed73f06ed3 [fix] ensure path works on windows because path.join doesnt like URLs 2014-09-12 07:50:16 -04:00
Jarrett Cruger
9a534c6ff6 [api] add prependPath option to go with path change 2014-09-11 18:51:49 -04:00
Sean Massa
a65021d52b fix tests for maintaining proxy path 2014-09-08 17:17:15 -05:00
Domi
511b7b3d47 Fix proxy path
This fix considers the actual target path again (which has been ignored).
2014-09-08 15:57:53 -05:00
Jarrett Cruger
261742a429 [fix] cleanup and stylize close function 2014-08-14 17:16:56 -04:00
Jarrett Cruger
f92f7aea9b Merge pull request #679 from RackspaceEmailAndApps/close_proxy
Added functionality to close proxy.
2014-08-14 17:12:42 -04:00
John Catron
8be9d945d0 updated close function for safety 2014-08-14 20:12:20 +00:00
Jarrett Cruger
37036dd325 [fix] emit an error if proper URL is not passed in as a target 2014-08-14 13:32:32 -04:00
John Catron
a3d02196c5 Added close method to proxy server.
Ensured server exists before closing.
Updated tests to use new close function.
Added documentation to README.
2014-08-14 17:30:38 +00:00
Manu Sporny
db5f2954b2 [api] Add event-based ability to modify pre-flight proxy requests. 2014-07-18 11:46:04 -04:00
Jarrett Cruger
5f838541cb do proper checking for a pass not existing. fixes #671 2014-07-17 10:56:53 -04:00
Jarrett Cruger
d1baa3684e [api] also emit the target on a proxy error 2014-07-08 16:12:57 -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
1213e46b1b Add the req and res objects to the proxyRes event 2014-05-12 08:22:54 +10:00
Jarrett Cruger
ccad177954 [minor] style 2014-05-11 01:02:35 -04:00
Jay Harris
d637b96420 Don't override connection header if Upgrading 2014-05-09 20:48:30 -04:00
Jarrett Cruger
77a1cff9bc [fix] handle error on incoming request as well and properly abort proxy if client request is aborted 2014-04-14 13:08:10 -04:00