117 Commits

Author SHA1 Message Date
Arttu Liimola
3d2350c54f Replaced Object.keys().map with for in loop. 2015-08-30 17:16:42 -04:00
Arttu Liimola
da674ec4df Modify the set-cookie header fix to work with node 0.10.x. 2015-08-30 17:16:07 -04:00
Arttu Liimola
8bfd90c4d9 Use raw headers instead parsed.
Set-Cookie headers are parsed into single header with cookies in array.
This messes up the Set-Cookie headers, because browser receives multiple Set-Cookie headers as single with cookies separted with comma.
2015-08-30 17:15:54 -04:00
Jarrett Cruger
d26ef56e1b [fix] dont use bind in the one case we do 2015-04-22 11:09:05 -04:00
Jarrett Cruger
18c77cafc7 [fix] use the main export for EE3 2015-04-22 11:07:13 -04:00
Jarrett Cruger
0db8f195d7 Merge pull request #759 from nodejitsu/ignore-path
[api] add an ignorePath option if you want to disregard the path of the ...
2015-04-20 16:47:27 -04:00
Jeremy Judeaux
5f14bcaa70 fix protocol and default port detection on node 0.12.x, compatible with 0.10.x 2015-04-02 14:23:58 +02:00
Jarrett Cruger
5a969d077b Merge pull request #787 from mokafive/master
Fixes / additions to URL rewriting
2015-04-01 12:20:37 -04:00
Damon McMinn
ab37a224aa Fix https://github.com/nodejitsu/node-http-proxy/issues/747 2015-04-01 13:19:03 +01:00
ashubham
df158bfc53 added auth header test 2015-03-12 15:11:56 -07:00
ashubham
ab5c3e5c81 auth header added 2015-03-12 13:15:06 -07:00
Feross Aboukhadijeh
6d074eff47 fix "x-forwarded-proto" in node 0.12 and iojs
The way to detect TLSSockets in node 0.12 and iojs has changed. You can
just check `socket.encrypted` now :)

Fixes #772
2015-03-11 00:33:34 -07:00
Matt Hauck
26029ba7ac only rewrite redirect urls when it matches target
if functioning as a reverse proxy for host1.foo.com,
with a backend target of backend.foo.com:8080, the
node proxy should only rewrite the redirect if it is
a redirect to somewhere on backend.foo.com:8080
2015-03-09 13:17:52 -07:00
Matt Hauck
7f2f3ac35c Add support for auto host rewriting and protocol rewriting
auto host rewriting allows rewriting to work as expected in most
cases without extra cumbersome configuration

protocol rewriting allows node-http-proxy to be able to listen
over HTTPS and properly reverse-proxy to sites running over HTTP
(to avoid doing SSL twice)
2015-02-05 12:17:26 -08:00
Jarrett Cruger
9eefd4678e [api] add an ignorePath option if you want to disregard the path of the incoming request when proxying to the target server fixes #758 2014-12-23 13:22:49 -05:00
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