Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

provide access to the windows identity of the authenticated user to node.js app #87

tjanczuk opened this issue Nov 21, 2011 · 3 comments


Copy link

When IIS is configured to require windows authentication, there is currently no way within the node.js application to determine the name of the authenticated user. This is to provide a mechanism to access that username. One possibility is to use X-* HTTP request headers to convey this information from iisnode to node.exe on a per-request basis.

This is from

Copy link

this would be very useful :)

Copy link
Owner Author

The fix is to provide a mechanism in iisnode to promote any of the IIS server variables to X-iisnode-* HTTP request headers.

To choose which of the IIS server variables are promoted to X-iisnode-* HTTP request headers, use the iisnode@promoteServerVars configuration property. It specifies a comma-separated list of IIS variables names. A variable FOO is promoted to X-iisnode-FOO HTTP request header only if it is actually defined for a particular request. By default no IIS server variables are promoted.

For example, to obtain the username of the authenticated caller and the authentication type, configure iisnode as follows:


    <!-- ... -->

    <iisnode promoteServerVars="AUTH_USER,AUTH_TYPE" />


The node.js application can then access these values using the following code:

var http = require('http');

http.createServer(function (req, res) {
    var username = req.headers['x-iisnode-auth_user'];
    var authenticationType = req.headers['x-iisnode-auth_type'];
    // ...

For a complete list of IIS server variables that can be promoted see

Copy link

@tjanczuk I know this has been here for a while now, but how would I replicate this without IIS or apache? I'm developing locally and just running the express app through command line/webstorm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet

No branches or pull requests

2 participants