multiple context roots for single application eap 6?
Environment
- RedHat JBoss Enterprise Application Platform (EAP)
- 6.x
Issue
- Is it possible to have a single web module inside an application to be registered at two context roots?
Resolution
- A web app can only be registered to one context.We can potentially route traffic to it from other contexts though.The One option is to rewrite other contexts to it. In addition to it we can enable the rewrite valve as described in [1] And then place a rule like the following in rewrite.properties:
RewriteRule ^/app2(.*) /app1$1 [L,R]
-
In that example, the application is deployed to the /app1 context. The rewrite above would then redirect any requests for /app2 to /app1 so clients can still get to the application after requesting /app2. It is only reached through a redirect though so the client would be changed to using /app1.
-
if anyhow httpd is in used front of JBoss, here is a simple proxy set up that would achieve this:
ProxyPass /app1 http://localhost:8080/app1
ProxyPass /app2 http://localhost:8080/app1
- So then the app is accessible over /app1 and /app2, and the client can continue to access the app via /app2 without being redirected to using /app1. If we did something like that, then we would want to use / path cookies, which can configure as described in [2]
[1]https://access.redhat.com/solutions/59515
[2]https://access.redhat.com/solutions/889513
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
