I’m trying to use mod_rewrite to map multiple domains to different servlets on one host.
Example:
http://www.dom1.com -> 192.168.1.n/dom1
http://www.dom2.com -> 192.168.1.n/dom2 …
I’m using the mod_rewrite and mod_proxy and VirtualHost directive but it seems that the reverse mapping via ProxyPassReverse doesn’t work as I expected.
ProxyPassReverse /subdomain.domain.com http://192.168.1.n/subdomain
doesn’t work. I’ve turned rewrite-logging on with
RewriteLog /var/log/rewrite.log
From the logs I’d say that rewriting works and the problem seems to be with reverse mapping. However I can’t see any Reverse mapping entries.
It seems that reverse mapping isn’t logged or needs a different command to be activated.
(Apache and the servlet container are on different machines but this should not matter I’d think ?)
After all I’ve found a solution that works for me.
This is an excerpt from my configuration that shows one virtual host for domain 1
What was wrong with my first configuration – I had to preserve the host and then add all necessary ProxyPassReverse rules to substitute the responses.
And this is my mod_proxy configuration:
There may be cleaner solutions but – if works as it should.