0

On our Ubuntu webserver we have a Apache2 HTTP server in conjunction with an JSF application running on an Tomcat8 application server using AJP 1.3 connector and HTTPS/SSL. I want my app which runs on localhost:8009/myApp/ to be accessible from https://subdomain.domain.com (subdomain and domain are palceholders of course). In other words, I want different context paths (/ on apache2, /myApp on tomcat)

Now I'm facing the problem that - althougth the welcome-page is accessible - all resources/images/links are broken as they still contain the context path /myApp. I've tried to set up corresponding ProxPass/ReverseProxyPass settings without success.

<VirtualHost _default_:443>
        ServerAdmin admin@domain.com
        DocumentRoot /srv/www/subdomain.domain.com
        ServerName subdomain.domain.com

        RewriteEngine On
        RewriteCond %{HTTP_HOST} !^subdomain\.domain\.com$ [NC]
        RewriteRule .? https://subdomain.domain.com%{REQUEST_URI} [R=301,L]

        <Location />
                ProxyPass ajp://localhost:8009/myApp/ connectiontimeout=5 timeout=300
                ProxyPassReverse https://localhost:8080/myApp/
                ProxyPassReverse https://subdomain.domain.com/myApp/
                ProxyPassReverse ajp://localhost:8009/myApp/
                ProxyPassReverseCookiePath /myApp/ /

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

</VirtualHost>

PS: As a workaround, myApp currently runs on the root-context "/" on tomcat, but I want to change that to accomondate multiple web apps.

In tomcat's conf/server.xml I have the following connector configured:

<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443"
           address="127.0.0.1"
           proxyName="subdomain.domain.com" proxyPort="443" secure="true" />
Raphael Roth
  • 101
  • 2

1 Answers1

0

you could try to add this rewrite condition:

RewriteCond %{REQUEST_URI} ^/myApp/ [NC]
RewriteRule ^/myApp(.*) https://subdomain.domain.com$1 [R=301,L]

like that your extra stuff should have correct link :

https://localhost:8080/myApp/ intead of https://localhost:8080/myApp/myApp/

Froggiz
  • 3,043
  • 1
  • 19
  • 30