Skip to content

Instantly share code, notes, and snippets.

@bparry02
Created November 12, 2014 00:57
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bparry02/d2d09cc24455e83d79a2 to your computer and use it in GitHub Desktop.
Save bparry02/d2d09cc24455e83d79a2 to your computer and use it in GitHub Desktop.
JBoss EAP 6.3 URL rewrite example (redirect the root context to a deployed application)
...
<subsystem xmlns="urn:jboss:domain:web:2.1" default-virtual-server="default-host" native="false">
<connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http"/>
<virtual-server name="default-host" enable-welcome-root="true">
<alias name="localhost"/>
<alias name="example.com"/>
<rewrite name="jboss" pattern="^/$" substitution="/jboss-helloworld/" flags="L,R=302"/>
</virtual-server>
</subsystem>
...
@bparry02
Copy link
Author

JBoss Web Subsystem - Virtual Server element description

JBoss URL Rewrite description

The flags used in the example are:

  • L - last rule, don't apply more rules
  • R=302 - redirect with HTTP code 302

@bparry02
Copy link
Author

JBoss CLI command:

/subsystem=web/virtual-server=default-host/rewrite=jboss:add(pattern="^/$", substitution="/jboss-helloworld/", flags="L,R=302")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment