I currently have:

server{
    ...
    if ($remote_user = "") {
        return 401;
    }
    ...
}

But what I really want is:

server{
    ...
    if ($remote_user = "") {
        add_header WWW-Authenticate 'Basic realm="mydomainhere.com"';
        return 401;
    }
    ...
}

But nginx won't allow me to use the add_header directive inside an if block.
How can I achieve this?

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,247218,247218#msg-247218

_______________________________________________
nginx mailing list
[email protected]
http://mailman.nginx.org/mailman/listinfo/nginx

Reply via email to