# Auth\_basic "pass through"

**URL:** <https://www.ruby-forum.com/t/auth-basic-pass-through/223202>\
**Category:** NGINX\
**Created:** [September 25, 2012, 9:02pm UTC](https://www.ruby-forum.com/t/auth-basic-pass-through/223202 "2012-09-25T21:02:18Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![aris](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/258eb7/32.png) [@aris](https://www.ruby-forum.com/u/aris)\
**Post date:** [September 25, 2012, 9:02pm UTC](https://www.ruby-forum.com/t/auth-basic-pass-through/223202/1 "2012-09-25T21:02:18Z")

</div>

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

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.

Has anyone run into this, or are there any suggestions?

Thanks,  
AJ

---

<div class="post-metadata">

**Author:** ![AJ\_Weber](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8c91f0/32.png) [@AJ\_Weber](https://www.ruby-forum.com/u/AJ_Weber)\
**Post date:** [September 25, 2012, 11:35pm UTC](https://www.ruby-forum.com/t/auth-basic-pass-through/223202/2 "2012-09-25T23:35:58Z")

</div>

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 / { proxy\_pass [http://127.0.0.1:10080/](http://127.0.0.1:10080/); } }

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.

## f

Francis D. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

---

<div class="post-metadata">

**Author:** ![AJ\_Weber](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/8c91f0/32.png) [@AJ\_Weber](https://www.ruby-forum.com/u/AJ_Weber)\
**Post date:** [September 26, 2012, 3:12am UTC](https://www.ruby-forum.com/t/auth-basic-pass-through/223202/3 "2012-09-26T03:12:43Z")

</div>

I _think_ I got this working (I will continue testing) by adding:  
proxy\_pass\_header Authorization;  
to the location.

Might have done the trick.

Thank you for the response.

-AJ
