0

I have an Ubuntu Server 14.04 with Apache 2.4.7 and Wildfly 8 installed. Apache runs in the front and Wildfly in the back. Apache proxies all the apps running on Wildfly.

Now I am trying to proxypass one of my apps from Wildfly with the domain mysubdomain.example.com, but I have unwanted side effects. It adds itself to the main domain example.com/mysubdomain as well, which is not what I want. First I added this configuration to /etc/apache2/sites-available/000-default.conf:

<VirtualHost *:80>
    ServerName mysubdomain.example.com
    ServerAlias www.mysubdomain.example.com
    ProxyPass / http://localhost:8080/myapp/
    ProxyPassReverse / http://localhost:8080/myapp/
</VirtualHost>

Then I added the same for SSH in /etc/apache2/sites-available/ssl.conf:

<VirtualHost *:443>
    SSLEngine on
    SSLCertificateFile /etc/ssl/certs/mysubdomain.mydomain.crt
    SSLCertificateKeyFile /etc/ssl/private/mysubdomain.mydomain.key

    ServerName mysubdomain.example.com
    ServerAlias www.mysubdomain.example.com

    ProxyPass / http://localhost:8080/myapp/
    ProxyPassReverse / http://localhost:8080/myapp/
</VirtualHost>

This configuration does not work like this. I was forced to add another configuration in order to make this work. I had to add into /etc/apache2/apache2.conf:

<Location "/myapp/">
    ProxyPass "http://localhost:8080/myapp/"
    ProxyPassReverse "http://localhost:8080/myapp/"
</Location>
<Location "/myapp">
    ProxyPass "http://localhost:8080/myapp"
    ProxyPassReverse "http://localhost:8080/myapp"
</Location>

This works (the good thing):

http://mysubdomain.example.com
https://mysubdomain.example.com

This comes with it (the bad thing):

http://example.com/mysubdomain

What must I do to only affect the subdomain without adding anything to the main domain?

Socrates
  • 261
  • 4
  • 13

0 Answers0