0

This question has been asked before, and, in resume I want configure this scenario:

1 - I have one Jetty 7 server with many applications, e.g: app1, app2, app3, etc.

2 - I have one main domain, and, one sub-domain per Jetty application, e.g: app1.example.com, app2.example.com, app3.example.com, etc..

3 - I'm try using Apache 2.2.22 mod_proxy to mask these Jetty applications across domains managed by Apache. This is my functional configuration for one application:

<VirtualHost *:80>
        ServerName example.com
        ServerAlias app1.example.com
        ProxyRequests Off
        ProxyPreserveHost On

        <Proxy *:80>
          Order deny,allow
          Allow from all
        </Proxy>
        ProxyPass /app1 http://localhost:8080/app1
</VirtualHost>

This configuration works, but, it doesn't remove the context name, the URI is:

http://app1.example.com/app1/?args=or/pages/etc...

Have an way to remove this context name, leaving a full transparent URIs ? e.g:

http://app1.example.com/?args=or/pages/etc..

All examples on the web uses this context name on URIS :/

Additional information:

  • VM with Ubuntu 12.04;
  • Jetty 7 without modifications;
  • Apache 2.2.22 with mod_proxy and mod_rewrite enabled (and some basics mods enabled by default);
  • Correct and valid CNAME and domain name within VM manager at Digital Ocean;

Thanks in advance.

Community
  • 1
  • 1
Carlos Spohr
  • 507
  • 11
  • 24

1 Answers1

0

I've found a solution:

1 - Install this specific lib for apache2 mod-proxy-html:

sudo apt-get install libapache2-lib-proxy-html

2 - Enable this new module:

sudo a2enmod proxy_html

3 - Config your application descriptor at:

sudo vim /etc/apache2/sites-enabled/app1 

with this content:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost
        ServerName app1.example.com
        ProxyRequests Off
        ProxyPreserveHost On

        <Proxy *:80>
          Order deny,allow
          Allow from all
        </Proxy>
        ProxyPass / http://localhost:8080/app1
        ProxyPassReverse / http://localhost:8080/app1

        ProxyHTMLURLMap / /app1/

        <Location />
                Order allow,deny
                Allow from all
        </Location>
</VirtualHost>

4 - Restart apache2 service:

sudo service apache2 restart

Be happy, transparent requests across:

http://app1.example.com/some/beautiful/page

Carlos Spohr
  • 507
  • 11
  • 24