0

I wanted to add VirtualHost to an existing apache 2.4 reverse proxy running on centos 7, but I encounter a problem resulting in error 403.

I have the following VirtualHost Setup

<VirtualHost *:80>
        ServerName newhost.example.com

        RewriteEngine On
        RewriteCond %{SERVER_PORT} !443
        RewriteRule ^(/(.*))?$ https://%{HTTP_HOST}/$1 [R=301,L]
</VirtualHost>

<VirtualHost *:443>
        ServerName newhost.example.com

        SSLEngine On
        ProxyPreserveHost On
        ProxyRequests Off
        SSLProxyEngine On

        ProxyPass /service1 http://172.20.100.138:8989/
        ProxyPassReverse /service1 http://172.20.100.138:8989/
        ProxyPass /service2 http://172.20.100.138:9191/
        ProxyPassReverse /service2 http://172.20.100.138:9191/
</VirtualHost>

When opening newhost.example.com/service1 in the browser I get error 403 forbidden.

If I change the proxypass lines to

ProxyPass / http://172.20.100.138:8989/
ProxyPassReverse / http://172.20.100.138:8989/

And open newhost.example.com I am able to access service1 without any errors.

Can anyone tell me what to add to make this work with /service1 and /service2?

0 Answers0