0

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

2 Answers 2

1

Check out ProxyPreserveHost directive

1

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.

2
  • 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, 2009 at 15:53
  • I have updated the post -- more testing has revealed a bigger problem.
    – Joshua
    Dec 9, 2009 at 16:24

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .