File tree 2 files changed +30
-3
lines changed
2 files changed +30
-3
lines changed Original file line number Diff line number Diff line change
1
+ var httpProxy = require ( 'http-proxy' ) ;
2
+ var Agent = require ( 'agentkeepalive' ) ;
3
+
4
+ var agent = new Agent ( {
5
+ maxSockets : 100 ,
6
+ keepAlive : true ,
7
+ maxFreeSockets : 10 ,
8
+ keepAliveMsecs :1000 ,
9
+ timeout : 60000 ,
10
+ keepAliveTimeout : 30000 // free socket keepalive for 30 seconds
11
+ } ) ;
12
+
13
+ var proxy = httpProxy . createProxy ( { target : 'http://whatever.com' , agent : agent ) ;
14
+
15
+ //
16
+ // Modify headers of the request before it gets sent
17
+ // So that we handle the NLTM authentication request
18
+ //
19
+ proxy . on ( 'proxyRes' , function ( proxyRes ) {
20
+ var key = 'www-authenticate' ;
21
+ proxyRes . headers [ key ] = proxyRes . headers [ key ] && proxyRes . headers [ key ] . split ( ',' ) ;
22
+ } ) ;
23
+
24
+ require ( 'http' ) . createServer ( function ( req , res ) {
25
+ proxy . web ( req , res ) ;
26
+ } ) . listen ( 3000 ) ;
Original file line number Diff line number Diff line change 3
3
"description" : " packages required to run the examples" ,
4
4
"version" : " 0.0.0" ,
5
5
"dependencies" : {
6
+ "agentkeepalive" : " ^2.0.3" ,
6
7
"colors" : " ~0.6.2" ,
7
- "socket.io" : " ~0.9.16" ,
8
- "socket.io-client" : " ~0.9.16" ,
9
8
"connect" : " ~2.11.0" ,
9
+ "connect-restreamer" : " ~1.0.0" ,
10
10
"request" : " ~2.27.0" ,
11
- "connect-restreamer" : " ~1.0.0"
11
+ "socket.io" : " ~0.9.16" ,
12
+ "socket.io-client" : " ~0.9.16"
12
13
}
13
14
}
You can’t perform that action at this time.
0 commit comments