1

Most already given answers are for situations where you want to hide the app-path. We are in the situation that only Requests beginning with "http://www.example.com/ourpath" are relayed to our apache.

Which means our apache rewrites

    ProxyPass "/ourpath/MyApp"  "ajp://internalcontainer:8009/MyApp"
    ProxyPassReverse "/ourpath/MyApp"  "ajp://internalcontainer:8009/MyApp"

The app itself is now reachable, but jsf builds urls like

http://www.example.com/MyApp/javax.faces.resource/jquery/jquery.js.xhtml?ln=primefaces&v=6.2

And ommits the "ourpath" part. Any idea how we can affect the context-path information of tomcat?

wutzebaer
  • 14,365
  • 19
  • 99
  • 170

1 Answers1

0

Ok i got a solution, the internal and external path MUST be the same, otherwise there is no reliable solution.

ProxyPass "/ourpath/MyApp"  "ajp://brainyoo2web:8009/ourpath/MyApp"
ProxyPassReverse "/ourpath/MyApp"  "ajp://brainyoo2web:8009/ourpath/MyApp"

And ensure the app is deployed in the same path:

COPY --from=webbuild /myapp/target/MyApp /usr/local/tomcat/webapps/ourpath#MyApp

or create a war file with the name ourpath#MyApp.war

The # tells tomcat there is a sub path in the url

wutzebaer
  • 14,365
  • 19
  • 99
  • 170
  • 1
    For the 'internal' path, you can, in tomcat at least, use the context.xml file to explicitly set the path. https://stackoverflow.com/questions/7276989/how-to-set-the-context-path-of-a-web-application-in-tomcat-7-0 – Kukeltje Jun 25 '20 at 10:54