You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Shabbir bharmal <bh...@gmail.com> on 2006/04/27 05:58:47 UTC

[users@httpd] Mod_header REMOTE_USER variable null via reverse proxy server - HELP!

I have Apache 2.2 setup using mod_proxy, mod_headers and mod_auth
successfully. I am using Apache as my web server and Apache Tomcat as
my web container where my application    is deployed.

Mod_auth challenges a browser session to enter a username and password
when accessing a page on my tomcat container. The username needs to be
set as a 'UserId' variable to be sent over to a reverse proxy
connection to a specific host where the application resides.

I have tried using the REMOTE_USER variable in a number of ways. To
show a couple of them:

1. RequestHeader set UserId %{REMOTE_USER}e
2. RequestHeader set UserId %{LA-U:REMOTE_USER}e

mod_proxy is used as a reverse proxy to send all browser sessions to
the Tomcat container.

ProxyPass / http://localhost:8080/
ProxyPassReverse / http://localhost:8080/

However, in all case, the UserId comes across as (null). I configured
TCPMON to check if Tomcat is for any reason messing the UserId, but
tcpmon shows that the http header UserId sent from the browser is
(null).

I would really appreciate if someone can point me in the right
direction to get this working. We are going live in a few days and time
is of essence.

What needs to be done to see REMOTE_USER variable,  (for that matter
REMOTE_HOST, REMOTE_IDENT, REMOTE_ADDR etc) OR am I using the wrong
variable and should use something else to capture the username from the
browser. Should anything be changed on the browser to send the username
across to the Apache server?

Thanks in advance.
Bharmal

Re: [users@httpd] Mod_header REMOTE_USER variable null via reverse proxy server - HELP!

Posted by Shabbir bharmal <bh...@gmail.com>.
You are right. that was a typo. Was using RequestHeader set UserId %{RU}e

This is resolved.

Regards
Shabbir

On 4/28/06, Joost de Heer <sa...@xs4all.nl> wrote:
>
> > RewriteRule .* - [E=RU:%{LA-U:REMOTE_USER}]
> > RequestHeader set UserId %{RU}
>
> Shouldn't that be
>
> RequestHeader set UserId %{RU}e
>
> ?
>
> Joost
>
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>    "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] Mod_header REMOTE_USER variable null via reverse proxy server - HELP!

Posted by Joost de Heer <sa...@xs4all.nl>.
> RewriteRule .* - [E=RU:%{LA-U:REMOTE_USER}]
> RequestHeader set UserId %{RU}

Shouldn't that be

RequestHeader set UserId %{RU}e

?

Joost


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Mod_header REMOTE_USER variable null via reverse proxy server - HELP!

Posted by Joshua Slive <jo...@slive.ca>.
On 4/27/06, Shabbir bharmal <bh...@gmail.com> wrote:
>
> Joshua,
> Thank you for your response. But, it did not work.  Here is a snippet from
> my httpd.conf file.

Then you'll probably need to write a custom module to do what you
want.  It shouldn't be too complicated, but I don't know the details.

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Mod_header REMOTE_USER variable null via reverse proxy server - HELP!

Posted by Shabbir bharmal <bh...@gmail.com>.
Joshua,
Thank you for your response. But, it did not work.  Here is a snippet
from my httpd.conf file.

### Start - SNIPPET FROM HTTPD.CONF##
ProxyRequests Off
ProxyPass / http://localhost:8081/
ProxyPassReverse / http://localhost:8081/

RewriteRule .* - [E=RU:%{LA-U:REMOTE_USER}]
RequestHeader set UserId %{RU}e

<Location />

 AuthUserFile "C:\Program Files\Apache Group\Apache2\sbacces"
 AuthName "Secured access Apache"
 AuthType basic
 Require valid-user

</Location>
### End - SNIPPET FROM HTTPD.CONF##

Output from TCPMON headers:

Host: localhost:8080
Accept: */*
Accept-Language: en-us
If-Modified-Since: Fri, 05 Aug 2005 15:03:27 GMT
If-None-Match: W/"92-1123254207000"
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; IE6SP1; SV1;
.NET CLR 1.0.3705; .NET CLR 1.1.4322)
Authorization: Basic c2FiOnNhYjEyMw==
*UserId: (null)*

Your help will be highly appreciated. THank you in advance.

Bharmal



On 4/27/06, Joshua Slive <jo...@slive.ca> wrote:
>
> On 4/26/06, Shabbir bharmal <bh...@gmail.com> wrote:
> > I have Apache 2.2 setup using mod_proxy, mod_headers and mod_auth
> > successfully. I am using Apache as my web server and Apache Tomcat as
> > my web container where my application    is deployed.
> >
> > Mod_auth challenges a browser session to enter a username and password
> > when accessing a page on my tomcat container. The username needs to be
> > set as a 'UserId' variable to be sent over to a reverse proxy
> > connection to a specific host where the application resides.
> >
> > I have tried using the REMOTE_USER variable in a number of ways. To
> > show a couple of them:
> >
> > 1. RequestHeader set UserId %{REMOTE_USER}e
> > 2. RequestHeader set UserId %{LA-U:REMOTE_USER}e
>
> Those variables are for mod_rewrite/mod_cgi and are not available to
> mod_headers.  You may be able to use something like:
>
> RewriteRule .* - [E=RU:%{LA-U:REMOTE_USER}]
> RequestHeader set UserId %{RU}
>
> Joshua.
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
>
>

Re: [users@httpd] Mod_header REMOTE_USER variable null via reverse proxy server - HELP!

Posted by Joshua Slive <jo...@slive.ca>.
On 4/26/06, Shabbir bharmal <bh...@gmail.com> wrote:
> I have Apache 2.2 setup using mod_proxy, mod_headers and mod_auth
> successfully. I am using Apache as my web server and Apache Tomcat as
> my web container where my application    is deployed.
>
> Mod_auth challenges a browser session to enter a username and password
> when accessing a page on my tomcat container. The username needs to be
> set as a 'UserId' variable to be sent over to a reverse proxy
> connection to a specific host where the application resides.
>
> I have tried using the REMOTE_USER variable in a number of ways. To
> show a couple of them:
>
> 1. RequestHeader set UserId %{REMOTE_USER}e
> 2. RequestHeader set UserId %{LA-U:REMOTE_USER}e

Those variables are for mod_rewrite/mod_cgi and are not available to
mod_headers.  You may be able to use something like:

RewriteRule .* - [E=RU:%{LA-U:REMOTE_USER}]
RequestHeader set UserId %{RU}

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org