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

All,

We are running into a peculiar issue.

We have Tomcat 6.0.24 front-ended by Apache2.2.3. We have a VirtualHost serving port 80 and a ServerAlias. Apache simply hands off "/" to Tomcat's load-balancer.

---------httpd.conf snippet:--------

<VirtualHost *:80>
    ServerName wwwprod.lsa.umich.edu
    ServerAlias wwwprod www www.lsa.umich.edu
    Redirect         / balancer://dsmdelivery/
    ProxyPass        / balancer://dsmdelivery/
    ProxyPassReverse / balancer://dsmdelivery/
    TraceEnable Off
</VirtualHost>

------------End of httpd.conf snippet----

Tomcat is tacking on an extra "/" as it creates a 302 response for one of the Server Aliases, and not the other as in the curl output below, when the URI does not have a trailing "/".

So you'll notice that:

http://www.lsa.umich.edu/polisci <== comes back with a "//" in Location Header of the the 302 redirect response message

http://wwwprod.lsa.umich.edu/polisci <== does not have a "//" in the Location header of the 302

-------------- Curl output for both virtual hosts:-------------

$ curl -v  http://wwwprod.lsa.umich.edu/polisci
* About to connect() to wwwprod.lsa.umich.edu port 80 (#0)
*   Trying 141.211.177.191... connected
* Connected to wwwprod.lsa.umich.edu (141.211.177.191) port 80 (#0)
GET /polisci HTTP/1.1
User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3
Host: wwwprod.lsa.umich.edu
Accept: */*
< HTTP/1.1 302 Moved Temporarily < Server: Apache-Coyote/1.1
< Location: http://wwwprod.lsa.umich.edu/polisci/
< Transfer-Encoding: chunked
< Date: Tue, 13 Sep 2011 20:28:29 GMT
<
* Connection #0 to host wwwprod.lsa.umich.edu left intact
* Closing connection #0
$
$
$ curl -v  http://www.lsa.umich.edu/polisci
* About to connect() to www.lsa.umich.edu port 80 (#0)
*   Trying 141.211.177.203... connected
* Connected to www.lsa.umich.edu (141.211.177.203) port 80 (#0)
GET /polisci HTTP/1.1
User-Agent: curl/7.19.7 (universal-apple-darwin10.0) libcurl/7.19.7 OpenSSL/0.9.8r zlib/1.2.3
Host: www.lsa.umich.edu
Accept: */*
< HTTP/1.1 302 Moved Temporarily < Date: Tue, 13 Sep 2011 20:28:47 GMT
< Server: Apache-Coyote/1.1
< Location: http://www.lsa.umich.edu//polisci/
< Content-Length: 0
< X-Cnection: close
< Content-Type: text/plain; charset=UTF-8
< Set-Cookie: BIGipServerlsa-cmsproddlv_pool=3232879501.20480.0000; path=/
<
* Connection #0 to host www.lsa.umich.edu left intact
* Closing connection #0

Notice the "//" in the second output above. This is causing the links to break.

(Both virtual hosts have a virtual server defined on the F5. The "www.lsa.umich.edu" virtual server has iRules attached to it. These haven't changed recently.)

Appreciate any thoughts.

Thanks!

share|improve this question

migrated from stackoverflow.com Sep 14 '11 at 8:56

This question came from our site for professional and enthusiast programmers.

1 Answer 1

I traced the problem to a missing "ProxyPreserveHost On" directive on the LSA and the II VirtualHosts. I added the missing directive, and things are working fine.

Apache documentation says:

When enabled, this option will pass the Host: line from the incoming request to the proxied host, instead of the hostname specified in the proxypass line.

This option should normally be turned Off. It is mostly useful in special configurations like proxied mass name-based virtual hosting, where the original Host header needs to be evaluated by the backend server.

In our case, we are doing mass name-based virtual hosting and were missing this directive.

share|improve this answer
    
@JoseK from what I read this is an answer. The user was able to solve the problem themselves and has posted their answer for everyone else's use, this is perfectly acceptable. –  Sam Oct 14 '11 at 10:53

Your Answer

 
discard

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