0

we have multiple different /apex instances. now we want to proxy the requests trough an Apache2-Server like this:

request for instance1: http://proxy:8080/apex -> http://apex1:8080
request for instance2: http://proxy:8081/apex -> http://apex2:8080

this could be solved trough the following VirtualHost.

<VirtualHost *:8080>
ProxyPass /apex/ http://apex1:8080/apex/
ProxypassReverse /apex/ http://apex1:8080/apex/
</VirtualHost>

<VirtualHost *:8081>
ProxyPass /apex/ http://apex2:8080/apex/
ProxypassReverse /apex/ http://apex2:8080/apex/
</VirtualHost>

but if enabled another virtualhost quits working It's like the other VirtualHosts overwrites the <VirtualHost :> matcher

Alias /server-info /opt/www/
<VirtualHost *:*>
        <Directory "/srv/www/">
                Allow from all
                AuthType Basic
                AuthName "Password Required"
                Require valid-user
                AuthUserFile /etc/apache2/.htpasswd
                DirectoryIndex  side.html
        </Directory>
</VirtualHost>

how to solve this issue?

BrotCast
  • 11
  • 3

1 Answers1

1

Problem Solved, with the following config

Alias /server-info /opt/www/
<VirtualHost 127.0.0.1:9000>
        <Directory "/srv/www/">
                Allow from all
                AuthType Basic
                AuthName "Password Required"
                Require valid-user
                AuthUserFile /etc/apache2/.htpasswd
                DirectoryIndex  side.html
        </Directory>
</VirtualHost>

ProxyPass /server-info/ http://127.0.0.1:9000/server-info-new/
ProxypassReverse /server-info/ http://127.0.0.1:9000/server-info-new/

through the proxypass /server-info can be accessed from any port

BrotCast
  • 11
  • 3