Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
node-http-proxy
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
node-http-proxy
Commits
8fc8d966
Commit
8fc8d966
authored
Sep 21, 2011
by
Charlie McConnell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[examples] Updated examples to v0.7.x API.
parent
24ef9194
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
17 deletions
+14
-17
examples/websocket/latent-websocket-proxy.js
examples/websocket/latent-websocket-proxy.js
+7
-9
examples/websocket/standalone-websocket-proxy.js
examples/websocket/standalone-websocket-proxy.js
+7
-8
No files found.
examples/websocket/latent-websocket-proxy.js
View file @
8fc8d966
...
...
@@ -67,12 +67,14 @@ socket.on('connection', function (client) {
//
// Setup our server to proxy standard HTTP requests
//
var
proxy
=
new
httpProxy
.
HttpProxy
();
var
proxyServer
=
http
.
createServer
(
function
(
req
,
res
)
{
proxy
.
proxyRequest
(
req
,
res
,
{
var
proxy
=
new
httpProxy
.
HttpProxy
({
target
:
{
host
:
'
localhost
'
,
port
:
8080
})
}
});
var
proxyServer
=
http
.
createServer
(
function
(
req
,
res
)
{
proxy
.
proxyRequest
(
req
,
res
);
});
//
...
...
@@ -83,11 +85,7 @@ proxyServer.on('upgrade', function (req, socket, head) {
var
buffer
=
httpProxy
.
buffer
(
socket
);
setTimeout
(
function
()
{
proxy
.
proxyWebSocketRequest
(
req
,
socket
,
head
,
{
port
:
8080
,
host
:
'
localhost
'
,
buffer
:
buffer
});
proxy
.
proxyWebSocketRequest
(
req
,
socket
,
head
,
buffer
);
},
1000
);
});
...
...
examples/websocket/standalone-websocket-proxy.js
View file @
8fc8d966
...
...
@@ -67,12 +67,14 @@ socket.on('connection', function (client) {
//
// Setup our server to proxy standard HTTP requests
//
var
proxy
=
new
httpProxy
.
HttpProxy
();
var
proxyServer
=
http
.
createServer
(
function
(
req
,
res
)
{
proxy
.
proxyRequest
(
req
,
res
,
{
var
proxy
=
new
httpProxy
.
HttpProxy
({
target
:
{
host
:
'
localhost
'
,
port
:
8080
})
}
});
var
proxyServer
=
http
.
createServer
(
function
(
req
,
res
)
{
proxy
.
proxyRequest
(
req
,
res
);
});
//
...
...
@@ -80,10 +82,7 @@ var proxyServer = http.createServer(function (req, res) {
// WebSocket requests as well.
//
proxyServer
.
on
(
'
upgrade
'
,
function
(
req
,
socket
,
head
)
{
proxy
.
proxyWebSocketRequest
(
req
,
socket
,
head
,
{
port
:
8080
,
host
:
'
localhost
'
});
proxy
.
proxyWebSocketRequest
(
req
,
socket
,
head
);
});
proxyServer
.
listen
(
8081
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment