1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice
  3. Dear Pleskians, I really hope that you will share your opinion in this Special topic for chatter about Plesk in the Clouds. Thank you!
    Dismiss Notice

how to configure reverse proxy rules properly?

Discussion in 'Plesk 10.x for Linux Issues, Fixes, How-To' started by ronv, Mar 19, 2012.

  1. ronv

    ronv Basic Pleskian

    22
     
    Joined:
    Jul 17, 2009
    Messages:
    29
    Likes Received:
    0
    Hi,

    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 define a reverse proxy rule that defers all traffic to -say- http://mydomain/tomcat/ to the Tomcat server running on port 8080. I have 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:

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

    Yet, I am getting a HTTP 403: Forbidden error when requesting above URL.

    I have made mod_rewrite log extensively, and find following entries in the logs:

    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 403. Addressing the testApp directly via <http://mydomain:8080/testApp> does work, and 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
     
  2. ronv

    ronv Basic Pleskian

    22
     
    Joined:
    Jul 17, 2009
    Messages:
    29
    Likes Received:
    0
    Ok,

    I've got one step further: I found out that the 403 error was probably caused by the proxy directive in /etc/apache2/mods-enabled/proxy.conf:

    <IfModule mod_proxy.c>
    ProxyRequests Off
    <Proxy *>
    AddDefaultCharset off
    Order deny,allow
    Deny from all
    #Allow from .example.com
    </Proxy>
    ProxyVia On
    </IfModule>

    Either changing that to allow it from .mydomain, or adding that in a proxy directive in /var/www/vhosts/mydomain/conf/vhost.conf, at least changes the error from 403 (forbidden) to 500 (internal server error).

    Yet, I cant find any further pointers as to where things go wrong. Nothing in any Apache nor Tomcat logs.

    As I said before, exactly the same configuration does work locally on my computer, so I'm sure it has to do with Plesk.

    Does anyone know what could be the issue?

    Ron
     
Loading...