Saturday, 22 February 2014

Redirect the request from Apache to tomcat using mod_proxy

If you want to redirect the apache request to tomcat[8080],use mod_proxy module.


You want access with this url

Please go to virtual host entry for in httpd.conf,

DocumentRoot /var/www/
ScriptAlias /cgi-bin/ /var/www/
#Options +Indexes
<Directory /var/www/>
AddHandler cgi-script .cgi .pl
ProxyPass /support/
RewriteEngine On
RewriteOptions Inherit

Also if you want to redirect some specific url's to another port use below method,

ProxyPassReverse / http://%{HTTP_HOST}:8080/
RewriteEngine on
RewriteCond  %{REQUEST_URI} .*\.(flv|mp4|mp3)$
RewriteRule ^/(.*) http://%{HTTP_HOST}:8080/$1 [P]

In this above example, requests for flv,mp4 & mp3 are redirected to port 8080 and then remaining ports are handled on regular port 80.

No comments:

Post a Comment