I have a Apache Webserver with mod_proxy and a Tomcat server with my Grails web app runnning. The Apache is redirecting with proxy the request to example.com:80 to my Tomcat running on example.com:8008.
I need to redirect requests the following way:
http://subdomain1.example.com:80/some-nice-seo-url
from apache should get per proxy to
http://example.com:8008/some-nice-seo-url-subdomain1
How can I archieve this with the following apache2 config:
NameVirtualHost *:80 <VirtualHost *:80> ServerName example.com ServerAlias www.example.com <Proxy *> Order deny,allow Allow from all </Proxy> # compress text, html, javascript, css, xml: AddOutputFilterByType DEFLATE text/plain AddOutputFilterByType DEFLATE text/html AddOutputFilterByType DEFLATE text/xml AddOutputFilterByType DEFLATE text/css AddOutputFilterByType DEFLATE application/xml AddOutputFilterByType DEFLATE application/xhtml+xml AddOutputFilterByType DEFLATE application/rss+xml AddOutputFilterByType DEFLATE application/javascript AddOutputFilterByType DEFLATE application/x-javascript ExpiresActive On ExpiresByType text/html "access plus 7 days" ExpiresByType image/gif "access plus 1 months" ExpiresByType image/jpeg "access plus 1 months" ExpiresByType image/png "access plus 1 months" ExpiresByType text/css "access plus 14 days" ExpiresByType text/javascript "access plus 14 days" ExpiresByType application/x-javascript "access plus 14 days" ExpiresByType image/ico "access plus 1 months" RewriteEngine on # www to non-www using search-engine friendly 301 RewriteCond %{HTTP_HOST} ^www.example.com [NC] RewriteRule ^(.*)$ http://example.com$1 [L,R=301] # IP canonicalization RewriteCond %{HTTP_HOST} ^1\.2\.3\.4 RewriteRule ^(.*)$ http://example.com/$1 [L,R=301] <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /opt/example/web-app> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> # redirect everything else to TOMCAT ProxyPass / http://1.2.3.4:8008/ ProxyPassReverse / http://1.2.3.4:8008/ ProxyPassReverseCookieDomain localhost example.com ProxyPreserveHost On </VirtualHost>
Thank you for any help!