I have an Apache server running on Linux. On the same host I’m running Xen with Windows Server 2008 + IIS. Windows gets a different IP address.
The host lives behind a NAT and I’ve configured it to direct port 80 to Linux and 8080 to Windows.
Apache offers a virtual host to handle incoming requests but these need to just be redirected to IIS, therefore my rewrite rule can be expressed as follows:
<VirtualHost ...>
ServerName www.firstdomain.com
...
RewriteEngine On
RewriteOptions Inherit
RewriteRule ^/(.*) http://www.seconddomain.com:8080/$1 [R,L]
This works fine since a request for www.seconddomain.com comes into the Apache VH, which rewrites the URL as www.secondomain.com:8080 and thus the browser now lands on IIS.
My question: I don’t want the user to see that the URL changed; I want it to behave the way that the passthrough option for rules works.
How can I accomplish this? And, if rewrite rules is the wrong approach, what is a better one?
Update
I found the [P]roxy flag for rules. This (almost) works great. I can put a file in the root of my IIS and reach it via http://www.seconddomain.com/tst.html – however, references within the document don’t get redirected properly e.g. the <img src='/images/tst.jpg' /> fails, showing there should have been an image in its place… what else do I need?
ok, it all works. I was just being dumb. the [P] is exactly what I needed.