How to hide application context in its url using Tomcat?

I have several applications running on Tomcat. Each has its own context. I connected them all to different domain names using the Apache HTTP server and mod_jk(see. More details on this question: How to connect a context-related Tomcat application with mod_jk? ) It works fine , but when applications create their web pages , all urls still have their contexts:

  • http://www.example.com/ goes into http://www.example.com:8080/my-context/
  • http://www.example.com:8080/my-context/ creates a web page
  • Webpage contains URL /my-context/some-page.jsf

I would like to see /some-page.jsfin the third step. It is important to note that I cannot change internal applications. They are provided by third parties. All I can do is configure Tomcat or Apache HTTP Server.

+2
source share
1 answer

It's a bit complicated, but you can use a URL repeater, for example tuckey to rewrite outgoing URLs by removing the / my -context prefix (by “outgoing URLs”, I mean the URLs created inside your webapps) . Check out the documentation for the http://urlrewritefilter.googlecode.com/svn/trunk/src/doc/manual/3.2/index.html element .

tuckey webapp, - . " ", . web.xml - ( ), , , ( ) webapp Tomcat, .

+4

Source: https://habr.com/ru/post/1795158/


All Articles