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" />
  • can u tell us what is images source link displayed in browser (while it is broken) ? – Froggiz Nov 4 '15 at 12:24
  • @Froggiz an images referrs to e.g. <img src="/myApp/resources/images/logo.png" height="40"> – Raphael Roth Nov 4 '15 at 12:29
  • so why not try to proxy localhost:8080 instead of localhost:8080/MyApp ? or rewrite /MyApp/ to / ? – Froggiz Nov 4 '15 at 12:31
  • because my app is not running on localhost:8080 (or maybe I don't understand your comment). – Raphael Roth Nov 4 '15 at 12:31
  • to test if your images (and other extar content) works using subdomain.domain.com/MyApp – Froggiz Nov 4 '15 at 12:43
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/

  • images are shown correctly, but other issues seem to arise (redirection etc) now... – Raphael Roth Nov 4 '15 at 12:58
  • can you please add more infos, i am not sure to understand – Froggiz Nov 4 '15 at 13:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.