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.

I have an Apache reverse proxy set to move requests to a Tomcat Applet. The config is similar to:

<VirtualHost 100.100.100.100:80>
    ProxyPass /AppName/App http://1.1.1.1/AppName/App
    ProxyPassReverse /AppName/App http://1.1.1.1/AppName/App
</VirtualHost>

I also have a page called summary.html that exists on 1.1.1.1 as:

http://1.1.1.1/AppName/summary.html

When I browse directly to it I have no problem viewing it, however if I try to get there via the reverse proxy I get a blank page. Wireshark shows me a 503, but this one is coming from the Apache reverse proxy (IP 100.100.100.100) and not the Tomcat (IP 1.1.1.1).

Should I add http://1.1.1.1/AppName/ to the config? How? I tried it but I get a blank page, however this one shows on the URL bar of the browser the internal IP of the Tomcat, so, no go.

Help is appreciated.

Thanks.

EDIT: This is the dump from Wireshark:

GET /AppName/ HTTP/1.1
Host: 100.100.100.100
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_6_8) AppleWebKit/534.52.7 (KHTML, like Gecko) Version/5.1.2 Safari/534.52.7
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Cache-Control: max-age=0
Accept-Language: en-us
Accept-Encoding: gzip, deflate
Connection: keep-alive

HTTP/1.1 404 Not Found
Date: Tue, 30 Jan 2012 09:08:51 GMT
Server: Apache
Content-Length: 1
Connection: close
Content-Type: text/html; charset=iso-8859-1
share|improve this question
add comment

2 Answers 2

I would use a rewrite rule instead.

http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule

try:

<VirtualHost 100.100.100.100:80>
    RewriteRule ^/AppName/(.*) http://1.1.1.1/AppName$1 [P]
</VirtualHost>
share|improve this answer
add comment

Adding it like this should work just fine:

<VirtualHost 100.100.100.100:80>
    ProxyPass /AppName/ http://1.1.1.1/AppName/
    ProxyPassReverse /AppName/ http://1.1.1.1/AppName/
</VirtualHost>

Or even:

<VirtualHost 100.100.100.100:80>
    ProxyPass /AppName/summary.html http://1.1.1.1/AppName/summary.html
    ProxyPassReverse /AppName/summary.html http://1.1.1.1/AppName/summary.html
    ProxyPass /AppName/App http://1.1.1.1/AppName/App
    ProxyPassReverse /AppName/App http://1.1.1.1/AppName/App
</VirtualHost>

Can you clarify what issue occurs when you have a config like this in place? I'm not quite sure what you mean by "this one shows on the URL bar of the browser the internal IP of the Tomcat".

share|improve this answer
    
When you browse to 100.100.100.100/AppName/summary,html it presents a blank page and the URL on the browser gets changed to 1.1.1.1/AppName/summary.html. –  Mr Aleph Jan 30 '12 at 15:43
    
Also, what if I want to do a generic error handling on Tomcat. Ideally every time a 404 or 500 or whatever is thrown I want to show a customized error.html. I have that in place on the config for Tomcat, however with the VirtualHost on Apache it doesn't display the error page either. –  Mr Aleph Jan 30 '12 at 15:46
    
@MrAleph Then you need to trace what's actually happening with the request; something's responding with a redirect, but Apache shouldn't allow that Location header in a response unmodified with a proper ProxyPassReverse config in place. Have you tried with the configs that I've provided? –  Shane Madden Jan 30 '12 at 16:10
    
I am doing it as I type. I'll post the reply in a bit. Thanks for the help –  Mr Aleph Jan 30 '12 at 16:13
    
Same story. All I get is a blank page. If I go directly to 1.1.1.1 then it's fine. Just as a test I assigned an external IP to 1.1.1.1. If I go directly to that one as 300.300.300.300/AppName/symmary.html then it's also fine. The minute I try from the reverse proxy then it doesn't work. So my guess is that the reverse proxy doesn't know where to go get that file. I can hardcode it as you said as ProxyPass /AppName/summary.html http://1.1.1.1/AppName/summary.html but that would not work for the error pages or if I want to add more pages –  Mr Aleph Jan 30 '12 at 18:25
show 4 more comments

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.