How to redirect request from apache to tomcat?

zipzip
zipzip used Ask the Experts™
on
Hi,

My question clearly stated in title.

If the request can be redirect, how about the session? can the session/header info maintain ?


Thanks.
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Top Expert 2010
Commented:
Hi

You can either Proxy (HTTP[s])  (See / Google Apache AND ProxyPass AND ProxyPassReverse AND RewriteRule [p] ) or alternatively use mod_jk (AJP) (See / Google: Apache AND JkMount AND workers.properties) to re-write the requests.
All depends on what your tomcat's configured to receive.  

Headers / Jsessions can be preserved.

For info:
http://httpd.apache.org/docs/2.2/mod/mod_proxy.html 
http://tomcat.apache.org/connectors-doc/generic_howto/workers.html 

Author

Commented:
Hi arober11,

I want to redirect http://localhost/liferay to another URL.

So, I had configured ProxyPass like this in apache,

ProxyPass        /liferay/       http://10.1.25.189:8080/c/portal/login(TOMCAT)

But the problem is I cannot get back the header info by using this:

HttpServletRequest.getHeader("REMOTE_USER")

any idea why the header info is not preserved?

Author

Commented:
Hi,

Im kinda new on this proxy thing, you mind to give me a sample on redirect configurations?
How to Generate Services Revenue the Easiest Way

This Tuesday! Learn key insights about modern cyber protection services & gain practical strategies to skyrocket business:

- What it takes to build a cloud service portfolio
- How to determine which services will help your unique business grow
- Various use-cases and examples

Author

Commented:
I am working in windows environment, familiar with IIS, but not apache..

Author

Commented:
Hi,


I found the code to solve this:

     RewriteEngine on
     RewriteCond %{REMOTE_USER} (.+)
     RewriteRule . - [E=RU:%1]
     RequestHeader set REMOTE_USER %{RU}e

Author

Commented:
The real answer I got it. But not from him

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial