We have an Apache webserver (acting as a proxy) that sits in front of several servers that have different applications running on them: IIS, Tomcat, jBoss, etc. The Apache server acts as a proxy on our single static external IP address. We have multiple domain names pointing to the single IP address, and Apache reroutes / proxies requests to the correct servers.
One issue is that when proxying to the IIS6 instance, the requests are routed all right, but when the user types in the domain name example.com/home their address bar changes to 192.168.10.30/home or whatever the internal IP address for that server is. Ouch.
Another issue is that when loading pages from the same IIS6 instance, we are getting issues where some of the content on a page loads but not all. Some images get 'lost', some javascript doesn't load, etc.
Note: I'm not blaming IIS6, but it is the only box we have experienced the issues with.
Here is the VirtualHost entry in Apache that I am using. Am I missing something with the config?
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ProxyPass / http://192.168.10.50/
ProxyPassReverse / http://192.168.10.50/
ProxyPreserveHost On
</VirtualHost>
Here is the 502 proxy error that SOMETIMES appears on requests (could be any random request -- css, js, html, etc.):
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>502 Proxy Error</title>
</head><body>
<h1>Proxy Error</h1>
<p>The proxy server received an invalid response from an upstream server.<br />
The proxy server could not handle the request <em><a href="/public/example/js/jquery-1.3.2.min.js">GET /public/example/js/jquery-1.3.2.min.js</a></em>.<p>
Reason: <strong>Error reading from remote server</strong></p></p>
</body></html>
Check out ProxyPreserveHost directive
IIS itself wouldn't cause that redirect unless it's specifically set to do so. It's most likely something in code doing the redirect, or a rule on your Apache reverse proxy causing that.
A good way to narrow it down is to test locally on the IIS box and see if it redirects. (although the test may be tainted since you'll be testing with a different IP). If it redirects there, then you know the source, otherwise it's up at the proxy level.