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.

[edit]: FWI, thanks to Vadym's comment below, I discovered that I had overlooked to enable mod_proxy_http on my Plesk server. Loading this module (alongside mod_proxy) fixed the original error.

I'm trying to configure reverse proxy rules in vhost.conf. I have Apache-2.2.8 on Ubuntu-8.04, monitored by Plesk-10.4.4.

What I'm trying to achieve is defining a reverse proxy rule that defers all traffic to -say- http://mydomain/tomcat/ to the Tomcat server running on port 8080. I have mod_rewrite and mod_proxy loaded in Apache. As far as I understand mod_proxy docs, entering following rules in /var/www/vhosts/mydomain/conf/vhost.conf should work:

<Proxy *>
  Order deny,allow
  Allow from all
</Proxy>

ProxyRequests off
RewriteRule ^/tomcat/(.*)$ http://mydomain:8080/$1 [P]

Yet, I am getting a HTTP 500: internal server error when requesting above URL. (Note: I decided to use a rewrite rule in order to at least get some information logged.)

I have made mod_rewrite log extensively, and find following entries in the logs [note: due to a limitation of max. 2 URLs in posts of new users, I have modified all following URLs so that they only contain 1 slash after http:. In case you're suspecting typos: this was done on purpose):

81.241.230.23 - - [19/Mar/2012:16:42:59 +0100] [mydomain/sid#b06ab8][rid#1024af8/initial] (2) init rewrite engine with requested uri /tomcat/testApp/

81.241.230.23 - - [19/Mar/2012:16:42:59 +0100] [mydomain/sid#b06ab8][rid#1024af8/initial] (3) applying pattern '^/tomcat/(.*)$' to uri '/tomcat/testApp/'

81.241.230.23 - - [19/Mar/2012:16:42:59 +0100] [mydomain/sid#b06ab8][rid#1024af8/initial] (2) rewrite '/tomcat/testApp/' -> 'http:/mydomain:8080/testApp/'

81.241.230.23 - - [19/Mar/2012:16:42:59 +0100] [mydomain/sid#b06ab8][rid#1024af8/initial] (2) forcing proxy-throughput with http:/mydomain:8080/testApp/

81.241.230.23 - - [19/Mar/2012:16:42:59 +0100] [mydomain/sid#b06ab8][rid#1024af8/initial] (1) go-ahead with proxy request proxy:http:/mydomain:8080/testApp/ [OK]

This suggests that the rewrite and proxy part is processed ok; still the proxied request produces a 500 error. Yet:

  • Addressing the testApp directly via http:/mydomain:8080/testApp does work.
  • The same setup does work on my local computer.

Is there something else (Plesk-related, perhaps?) I should configure?

Many thanks for any pointers!

Ron

share|improve this question

1 Answer 1

up vote 0 down vote accepted

Are there any clues within ErrorLog?

Have you tried the same thing without mod_rewrite (just mod_proxy) like this:

  <Location /tomcat>
    ProxyPass http://mydomain:8080/
    ProxyPassReverse http://mydomain:8080/
  </Location>
share|improve this answer
    
Thanks for your suggestion. I had tried normal proxy rules before (and have now tried to put them inside <Location> as you suggested). Same result: HTTP 500 error, without any trace at all in error.log (nor any other logfile I can find, which is quite maddening). Actually, that's why I resorted to a RewriteRule, to get at least some logging. –  rvdb Mar 25 '12 at 18:47
    
As just a random shot, do you have mod_proxy_http enabled in your server config? –  Vadym S. Khondar Mar 25 '12 at 20:55
    
Spot on, nice shot! Sorry for having overlooked this trivial config issue. You already made the first day of my week, Vadym. Thanks a lot! –  rvdb Mar 26 '12 at 7:37

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.