# Ldap authentication passing to tomcat

**URL:** <https://www.ruby-forum.com/t/ldap-authentication-passing-to-tomcat/235098>\
**Category:** NGINX\
**Created:** [May 30, 2013, 10:41pm UTC](https://www.ruby-forum.com/t/ldap-authentication-passing-to-tomcat/235098 "2013-05-30T22:41:00Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![alcina](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/a587f6/32.png) [@alcina](https://www.ruby-forum.com/u/alcina)\
**Post date:** [May 30, 2013, 10:41pm UTC](https://www.ruby-forum.com/t/ldap-authentication-passing-to-tomcat/235098/1 "2013-05-30T22:41:00Z")

</div>

I am using nginx 1.4.1 as reverse proxy for tomcat 7.0.33. Using LDAP  
for  
user authentication.  
Everything works fine except one critical thing: the authenticated user  
ID  
does not get to tomcat. I see it in the Tomcat’s access log: it shows  
“-”  
where the ID is supposed to be.

I tried to set various header elements in nginx.conf, see below a  
fragment  
of it (I experimented with them, turning them on and off).  
Using tcpdump, I confirmed that all the elements that I set indeed go to  
the  
HTTP request.

The same thing with Apache HTTPD works properly, but there we use AJP.

What am I missing? Any other header field I need to set?  
Also, can anybody tell me how Tomcat retrieves the authenticated user ID  
from the request header? What is that field exact name?

auth\_ldap\_url …  
auth\_ldap\_binddn removed\_email\_address@domain.invalid;  
auth\_ldap\_binddn\_passwd …;  
auth\_ldap “Enter your Windows/Network Login To Access MoonWeb”;  
auth\_ldap\_require valid\_user;

```
server {
    listen mcny14.mooncapital.corp:8880;
    server_name mcny14.mooncapital.corp;

    location /moon/ {

        #proxy_pass_header Set-Cookie;
        #proxy_ignore_headers Expires Cache-Control;
        proxy_redirect off;
        proxy_buffering off;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-Host $host;
        proxy_set_header Host $host;
        proxy_set_header X-Forwarded-Server $host;
        proxy_set_header X-Forwarded-For

```

$proxy\_add\_x\_forwarded\_for;  
proxy\_set\_header X-Forwarded-User $remote\_user;  
proxy\_set\_header Remote-User $remote\_user;  
proxy\_set\_header User $remote\_user;  
proxy\_set\_header REMOTE\_USER $remote\_user;  
proxy\_set\_header X-URL-SCHEME https;  
#proxy\_set\_header Authorization “”;

```
      root mdocs;
      proxy_pass http://mcny14:8801;
    }

```

Posted at Nginx Forum:

> **[Ldap authentication passing to tomcat](https://forum.nginx.org/read.php?2,239703,239703#msg-239703)**
>
> I am using nginx 1.4.1 as reverse proxy for tomcat 7.0.33. Using LDAP for user authentication. Everything works fine except one critical thing: the authenticated user ID does not get to tomcat. I see it in the Tomcat's access log: it shows...
