07/01/15

Redirect from Apache2 to Tomcat

I need to redirect the content from a Tomcat server on the Apache2 container, remaining invisible to the user.

In other words, going to this address:

http://mysite.net/mypage

I want to see what is on:

http://mysite.net:8080/myapplet/page

Proxypass

I first tried with the ProxyPass directive in the default file in /etc/apache2/sites-available, within the VirtualHost tags.

ProxyPass /mypage http://mysite.net:8080/myapplet/page
ProxyPassReverse /mypage http://mysite.net:8080/myapplet/page

<Location "/mypage">
Order allow,deny
allow from all
</Location>

This solution is not satisfactory, as it does not find the css, javascript files etc.

Rewrite

I tried then with mod_rewrite (check if you have enabled it).

RewriteEngine on
RewriteRule ^/mysite.net http://mysite.net:8080/myapplet/page [P]
RewriteRule ^/mysite.net/(.*) http://mysite.net:8080/myapplet/$1 [P]


Same problem as before. Unfortunately, I'm not able to rewrite all the links in the web-page with a simple modification.




Forward

The easiest (and unfortunately the ugliest) solution is a simple forward.

Redirect mysite.net http://mysite.net:8080/myapplet/page

Nessun commento:

Posta un commento