I have a configuration that works for explicitly declared server names:
<VirtualHost *:80>
ServerAdmin me@myco.com
ServerName sub0.sub1.myco.com
ProxyRequests Off
ProxyPreserveHost On
<Proxy *>
Order deny,allow
Allow from all
</Proxy>
ProxyPass / http://sub0.sub1.myco.com:8080/mobilecommerce/
ProxyPassReverse / http://sub0.sub1.myco.com:8080/mobilecommerce/
ProxyPassReverseCookieDomain sub0.sub1.myco.com:8080/mobilecommerce sub0.sub1.myco.com
ProxyPassReverseCookiePath /mobilecommerce /
ErrorLog "/private/etc/apache2/extra/log/apache2/local-error_log"
CustomLog "/private/etc/apache2/extra/log/apache2/local-acess_log" common
</VirtualHost>
What this does:
- given an incoming url request with specific sub0, sub1 and domain name,
- repeat the long url, only add port number 8080,
- then append with the servlet context: mobilecommerce.
However, I may have multiple sub0 and sub1 created over time. What I like to do is use wildcard for them, and still trigger the same rule -- just pass sub0 and sub1 in the translated url.
Is that possible with mod_proxy? If not, how about mod_jk?