mirror of
https://github.com/http-party/node-http-proxy.git
synced 2025-12-08 20:59:18 +00:00
Merge pull request #903 from nodejitsu/ntlm-authentication
[example] add an example for NTLM authentication
This commit is contained in:
commit
ab42124d54
26
examples/http/ntlm-authentication.js
Normal file
26
examples/http/ntlm-authentication.js
Normal file
@ -0,0 +1,26 @@
|
|||||||
|
var httpProxy = require('http-proxy');
|
||||||
|
var Agent = require('agentkeepalive');
|
||||||
|
|
||||||
|
var agent = new Agent({
|
||||||
|
maxSockets: 100,
|
||||||
|
keepAlive: true,
|
||||||
|
maxFreeSockets: 10,
|
||||||
|
keepAliveMsecs:1000,
|
||||||
|
timeout: 60000,
|
||||||
|
keepAliveTimeout: 30000 // free socket keepalive for 30 seconds
|
||||||
|
});
|
||||||
|
|
||||||
|
var proxy = httpProxy.createProxy({ target: 'http://whatever.com', agent: agent);
|
||||||
|
|
||||||
|
//
|
||||||
|
// Modify headers of the request before it gets sent
|
||||||
|
// So that we handle the NLTM authentication request
|
||||||
|
//
|
||||||
|
proxy.on('proxyRes', function (proxyRes) {
|
||||||
|
var key = 'www-authenticate';
|
||||||
|
proxyRes.headers[key] = proxyRes.headers[key] && proxyRes.headers[key].split(',');
|
||||||
|
});
|
||||||
|
|
||||||
|
require('http').createServer(function (req, res) {
|
||||||
|
proxy.web(req, res);
|
||||||
|
}).listen(3000);
|
||||||
@ -3,11 +3,12 @@
|
|||||||
"description": "packages required to run the examples",
|
"description": "packages required to run the examples",
|
||||||
"version": "0.0.0",
|
"version": "0.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"agentkeepalive": "^2.0.3",
|
||||||
"colors": "~0.6.2",
|
"colors": "~0.6.2",
|
||||||
"socket.io": "~0.9.16",
|
|
||||||
"socket.io-client": "~0.9.16",
|
|
||||||
"connect": "~2.11.0",
|
"connect": "~2.11.0",
|
||||||
|
"connect-restreamer": "~1.0.0",
|
||||||
"request": "~2.27.0",
|
"request": "~2.27.0",
|
||||||
"connect-restreamer": "~1.0.0"
|
"socket.io": "~0.9.16",
|
||||||
|
"socket.io-client": "~0.9.16"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user