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
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
Jarrett Cruger
4f07dc220d
[fix] let user make the decision on what to do with the buffer
2014-04-10 20:02:46 -04:00
Jarrett Cruger
8b48a9fdab
[api] emit a start an an end event
2014-04-09 13:38:13 -04:00
Jarrett Cruger
c6b7a7919f
[fix] always be an eventemitter for consistency fixes #606
2014-04-09 13:37:27 -04:00
Jarrett Cruger
5251a238e7
Merge branch 'customizeOutgoingAddress' of github.com:sberan/node-http-proxy into sberan-customizeOutgoingAddress
...
Conflicts:
lib/http-proxy.js
lib/http-proxy/common.js
2014-03-26 22:30:11 -04:00
Jarrett Cruger
89a22bc003
[fix] set connection to CLOSE in cases where the agent is false.
2014-03-26 22:07:09 -04:00
Jarrett Cruger
a7b16eb136
[api] add toProxy method to allow absolute URLs to be sent when sending to another proxy fixes #603
2014-03-26 21:59:10 -04:00
Alexander
99f757251b
Fix for #591
...
Fix for proxy crash if `HOST` header is not defined bug https://github.com/nodejitsu/node-http-proxy/issues/591 .
2014-02-26 15:12:38 +02:00
Sam Beran
e633b0f7e4
Add support for localAddress
...
When we make outgoing requests, we may want to bind to a specific local
address. This change allows the localAddress property to be specified
via the options object.
2014-02-11 15:01:03 -06:00
David Glasser
4c3ba74c4e
Close outgoing ws if incoming ws emits error
...
Fixes #559 , which contains a full reproduction recipe.
2014-01-28 13:58:09 -05:00
Jarrett Cruger
daad4703f3
[fix] replicate node core behavior and throw an error if the user does not add their own error listener
2014-01-28 12:32:43 -05:00
David Glasser
0b223abb65
Fix argument order for ws stream pass
...
head and error handling was broken before this commit.
2014-01-22 15:28:23 -08:00
p-a-c-o
96ea631fb6
Extend listen to enable IPv6 support.
2014-01-21 20:35:49 +01:00
alevicki
c5ec1836b2
Fix before and after type check
2014-01-20 10:24:53 -06:00