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

NTLM issue with undefined www-authenticate header #938

Open
merpnderp opened this issue Jan 21, 2016 · 2 comments
Open

NTLM issue with undefined www-authenticate header #938

merpnderp opened this issue Jan 21, 2016 · 2 comments

Comments

@merpnderp
Copy link
Contributor

While using the #727 example code to get NTLM working behind node-http-proxy, I saw an error on the second response from my node-sspi server.

In line 85 of http-outgoing.js an error was thrown that looked like this:

_http_outgoing.js:342
throw new Error('value required in setHeader("' + name + '", value).');
^

Error: value required in setHeader("www-authenticate", value).
at ServerResponse.OutgoingMessage.setHeader (_http_outgoing.js:342:11)

I created a net server that simply piped everything from the http-proxy to my app and another that piped everything from the browser to http-proxy and also outputted everything to stdout so I could compare what was going into and out of http-proxy. And when that error is thrown the header www-authenticate is not returned from node-sspi. It looks like it is somehow cached or held in a reused object inside of node-http-proxy.

My simple fix for now is to change line 85 of web-outgoing.js to: if(proxyRes.headers[key]){ res.setHeader(key, proxyRes.headers[key]);} but I'm not sure if that is the best solution since http-proxy is trying to set a header for which nothing was passed in.

@jcrugzz
Copy link
Contributor

jcrugzz commented Jan 21, 2016

@merpnderp i do find this very strange that this is happening but i would take a PR that adds that safety if clause

@merpnderp
Copy link
Contributor Author

Looks like the pull request test in Travis CI timed out. Don't think the safety check I added should break anything. Could the test be restarted to see if it was just a network issue?

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

No branches or pull requests

2 participants