Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have the following setup in my Nginx (1.2.6 on Windows 7) conf file:

location ~ ^/FOO/(.*)$ {
    proxy_pass    http://server_two:8888/FOO/$1;

On server_two I have IIS7 running a WCF service that uses basic authentication. When I visit http://server_two:8888/FOO/Service.svc?wsdl I get the correct endpoint.

When I visit http://myhost/FOO/Service.svc?wsdl I get a user/pass box that pops up. I can enter my credentials until the cows come home and still nothing. I've also tried the following:

location ~ ^/FOO/(.*)$ {
    proxy_pass    http://server_two:8888/FOO/$1;
    proxy_set_header Host $host;
    proxy_set_header X-Accel-Expires 0;
    proxy_set_header X-Real-IP $remote_addr;
    proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

And several other variants, but as yet I'm not able to get the login process to work. Is this possible with Nginx? What am I missing?


I forgot to mention, IIS is setup to do an HTTP 401 Challenge for Windows Authentication

share|improve this question
Shouldn't it be http://myhost/FOO/FOO/Service.svc?wsdl with your current config? – Mathias R. Jessen Dec 28 '12 at 0:23
@MathiasR.Jessen I just changed it to http://server_two:8888/$1 - I still get the authentication issues. As far as I can tell, it's not correctly passing the authentication (user/pass) through to IIS - or back again. That communication is broken somewhere – Wayne Werner Dec 28 '12 at 13:08
up vote 2 down vote accepted

By default NGINX doesn't use keepalive on upstream connections and that may cause the authentication issue since the TCP connections are not maintained. I would try to turn the keepalive on. See

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.