Reputation: 2688
Here's the scenario.
Server is Win2k8, running IIS 7.5. I have ARR and URL Rewrite2 installed.
I have a virtual box running the latest Ubuntu Server. Apache, mySQL, PHP are all installed.
I have IIS configured as a reverse proxy, and have setup a URL ReWrite as such:
<rewrite>
<rules>
<rule name="ReverseProxyInboundRule1" stopProcessing="false">
<match url="(.*)" />
<action type="Rewrite" url="http://192.168.1.17/{R:1}" />
</rule>
</rules>
</rewrite>
I have verified that http://dev.o7t.in correctly gets routed to the configured site in apache on the VM, however, http://wp.o7t.in gets directed to the same exact place. Here's the config from both sites in apache:
Dev:
# NameVirtualHost *:80
<VirtualHost *>
ServerName devo7tin
ServerAlias dev.o7t.in
ServerAdmin [email protected]
DocumentRoot /var/www/dev/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/dev/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
wp:
# NameVirtualHost *:80
<VirtualHost *>
ServerName wpo7tin
ServerAlias wp.o7t.in
ServerAdmin [email protected]
DocumentRoot /var/www/wordpress/
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/wordpress/>
Options -Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
</VirtualHost>
and NameVirtualHost is configured already in ports.conf
What I am noticing is the Host Header, always reverts to the IP address of the virtual machine (in this case 192.168.1.17), and completely ignores the requested host.
So.... how can I get around this, and pass my VM the correct HTTP_HOST header?
Upvotes: 0
Views: 1804
Reputation: 2688
I was right. It was an IIS thing not sending the HTTP_HOST header. Of course, why would they post it anywhere, but apparently ARR by default disables, however, it can be enabled via:
appcmd.exe set config -section:system.webServer/proxy /preserveHostHeader:"True" /commit:apphost
Configured this, and it now works!
Upvotes: 3