auth_basic "pass through"

Francis Daly francis at
Tue Sep 25 21:35:14 UTC 2012

On Tue, Sep 25, 2012 at 03:01:15PM -0400, AJ Weber wrote:

Hi there,

> I'm having trouble setting up nginx in front of tomcat to handle ssl and 
> reverse proxy/caching.

    server {
        location / {

seems to work for me, at least for the auth_basic "pass through" part.

What trouble are you seeing?

(nginx -V, nginx.conf, url you request, response you get, response
you expect?)

> Basically the webapp behind nginx uses http authentication (browser 
> prompts, not a webpage login), and I think what's happening is that 
> handshake/traffic is not getting back and forth for the initial 
> connection.  The authentication is performed against a custom 
> implementation, so I can't just remove it and move it to a passwd file.

If the backend returns http 401, then nginx should send that to the
client, which it does for me with

WWW-Authenticate: Basic realm="dir".

In this case, nginx doesn't use auth_basic at all, and doesn't care what
the back end does to decide whether to send 401 or 200.

Francis Daly        francis at

More information about the nginx mailing list