Thursday, September 6, 2012

Redirect Incoming and Outgoing requests from/to Apache Server to/from Apache-Tomcat

I do not want to be recursive but i believe this can be usefull for someone(newbies)  as it was for me in the time that i needed.

Most of you can ask a question, why am i writing this post in English,  well, in fact there is only one reason, i speak portuguese all day long.

That's it...Jumping to the post...., shortcuting the to the results, let's go:

Redirecting incoming from Apache to Tomcat and vice-versa


There is a request to provide an application to internal users of an Enterprise. This enterprise uses his Data Center which is the core of all applications and services they provide to internal users and customers. The DC follow the standard like three tier architecture. But for this specific situation, we are going to use the following assumptions.


  • The Presentation Layer is based on Apache Server 2 which provide html pages to the users
  • At application layer we have a Apache-Tomcat 7 Application Server hosting the application like Asset Management
  • Both Apache Server and Apache-Tomcat are running on same server on top of Solaris 10 OE
  • Both Apache Server and Apache-Tomcat are installed following default configuration (no customization, no server hardening) and Proxy Modules are loaded: 
LoadModule proxy_module libexec/
LoadModule proxy_connect_module libexec/
  • The access to the Apache Server is based on the following url:
  • The url provided by the application is

Problem Definition:

The url which was published to the company to access this application is, which leads us to reconfigure the apache server to redirect the incoming request from (default port is 80) to a content directory /assetmanagement on on port 8080, default for Apache-Tomcat.


First, we need to understand that Apache Server is listening on port 80 and the application Server open a session on port 8080 to provide the application. We do not want to change default settings for future hosting in the same environment:

  1.  edit the core configuration file of the Apache Web Server with your favorite text editor:
bash-3.2# vi /etc/apache2/httpd.conf

and add at the end of the file the following directives:


 < VirtualHost :80 >
        proxyPass   /
        proxyPass   /
        ErrorLog      /var/apache2/logs/assetmanagement-error_log
        CustomLog  /var/apache2/logs/assetmanagement-access_log common

< /VirtualHost >

2.        Then restart the apache service like:

bash-3.2#  /usr/apache2/httpd –k restart 

Now, the resquest for application will be handled by the Apache Server on default port like 80 and using proxy reverse it will pass and reverse the requests to the Apache-Tomcat on port 8080 and vice-versa.


No comments: