Skip to content

Commit df6e421

Browse files
committed
added note about reverse proxies
1 parent b357e45 commit df6e421

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

README.md

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,16 @@ An express middleware to have basic NTLM-authentication in node.js.
88
99
*Active Directory support is heavily inspired by [PyAuthenNTLM2](https://github.com/Legrandin/PyAuthenNTLM2/).*
1010

11+
## important notes on (reverse) proxies and NTLM
12+
13+
NTLM is designed for corporate networks without a proxy between the client and the application. It does authorise the TCP connection instead of the HTTP session and with a proxy between, it'll authorise the connection between the proxy and the application and therefore mixing up users if the proxy shares the same connection or "forgetting" users if the proxy suddenly uses a different connection for the same user.
14+
15+
In an early state of this module `express-ntlm` tried to create a session during the negotiation, which failed (see [`50d9ac4`](https://github.com/einfallstoll/express-ntlm/commit/50d9ac4a06552ab39d49eadf9efe68f02d122176)) even though [RFC6265](https://tools.ietf.org/html/rfc6265#section-3) makes it clear it MUST be possible: "User agents [...] MUST process Set-Cookie headers contained in other responses (including responses with 400- and 500-level status codes)."
16+
17+
A possible solution to this problem might be to set the `keep-alive` property in nginx as mentioned in an [answer from StackOverflow regarding this issue](http://stackoverflow.com/a/22918442/377369) but it could end in the "multiple-users same-connection"-problem [mentioned from another user](http://stackoverflow.com/a/22806907/377369).
18+
19+
Another option would be to abandon the proxy completely and connect directly to the application on port 80 or build a custom reverse proxy that authenticates the user, creates a session and keeps the session data on a shared store, that is accessible by all applications behind the proxy (e.g. [expressjs/session](https://github.com/expressjs/session) in combination with [visionmedia/connect-redis](http://github.com/visionmedia/connect-redis)).
20+
1121
## install
1222

1323
$ npm install express-ntlm
@@ -61,7 +71,7 @@ It's not recommended, but it's possible to add NTLM-Authentication without valid
6171
var args = Array.prototype.slice.apply(arguments);
6272
console.log.apply(null, args);
6373
}
64-
74+
6575
### logging to [debug](https://github.com/visionmedia/debug) (or similiar logging-utilities)
6676

6777
function() {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "express-ntlm",
3-
"version": "2.1.4",
3+
"version": "2.1.5",
44
"description": "An express middleware to have simple NTLM-authentication.",
55
"main": "index.js",
66
"scripts": {

0 commit comments

Comments
 (0)