Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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>
share|improve this question

2 Answers 2

up vote 1 down vote accepted

Check out ProxyPreserveHost directive

share|improve this answer

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.

share|improve this answer
    
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

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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