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 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 /
    ProxyPassReverse /
    ProxyPreserveHost On

Here is the 502 proxy error that SOMETIMES appears on requests (could be any random request -- css, js, html, etc.):

<title>502 Proxy Error</title>
<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&nbsp;/public/example/js/jquery-1.3.2.min.js</a></em>.<p>
Reason: <strong>Error reading from remote server</strong></p></p>

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.

  • I did test it on the IIS box using localhost, and it does not exhibit the behavior. I added my virtualhost entry above if that helps clarify? – Joshua Nov 30 '09 at 15:53
  • I have updated the post -- more testing has revealed a bigger problem. – Joshua Dec 9 '09 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.