Is there a way in JBOSS to have different URLs provided by the users resolve to other URLs; i.e.

http://OurAppUat/ => http://OurAppUat/web/app?environment=UAT
http://OurAppSIT/ => http://OurAppSIT/web/app?environment=SIT


Skip this bit unless you're thinking "what problem are you trying to solve?".

We have an web app developed by a third party which is hosted on JBoss.
This app is our company's operations system; available internally only. We have some customisations, and as such have SIT, UAT and Production Replica environments to allow us to test customisations and reproduce production issues.

For various reasons, we often need to switch around the servers hosting environments (e.g. so we can prepare a refreshed copy of UAT on the SIT server whilst the current UAT environment's in use, then switch the users/testers to the refreshed instance before moving and refreshing SIT onto the former UAT server).

It is possible for multiple environments to be hosted independently on the same server; but we try to avoid this when possible to ensure the environments aren't affected by testing being done in another environment, and also to allow us to restart servers/services as required without concerning ourselves with other instances which may be sharing the same host.

What we're trying to do

Users currently connect to the app on URLs such as:

  • http://myServer01/web/app?environment=UAT
  • http://myServer02/web/app?environment=SIT

We'd like to simplify this to:

  • http://OurAppUat/
  • http://OurAppSIT/

Using DNS we can get as far as:

  • http://OurAppUat/web/app?environment=UAT
  • http://OurAppSIT/web/app?environment=SIT

The advantage is this allows us to switch servers around behind the scenes (and perhaps add in load balancing down the line) without affecting the URLs used by our users. That's achieved by repointing the DNS name to the correct resource's IP.

The further advantage of removing the rest of the URL is the URLs become human readable; with so users can look at the URL and tell what environment they're in without having to understand which part of the URL to read (though it looks obvious, most users seem to panic at the site of a long URL rather than just scanning it for the environment name).

Similar Questions


JBoss does support rewrite rules which can be used to support this. From the documentation, you would first have to add this configuration in the server.xml file:

<Valve className="org.jboss.web.rewrite.RewriteValve" />

Then you would have to create a rewrite.properties file with something like this:

RewriteRule  ^/$  /web/app?environment=UAT  [L]
| improve this answer | |

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.