How to change WildFly default Welcome page

In this article we will learn how to replace (or disable) the default Welcome page for WildFly and JBoss EAP which is by default available at localhost:8080.

WildFly users

To configure an application as default Web app requires two simple steps.

Firstly, in your undertow server remove the default welcome application from your host. You can do it from the Command Line Interface as follows:

/subsystem=undertow/server=default-server/host=default-host/location=\/:remove
{
    "outcome" => "success",
    "response-headers" => {
        "operation-requires-reload" => true,
        "process-state" => "reload-required"
    }
}

Then, you can set the default-web-module of your undertow host as follows:

/subsystem=undertow/server=default-server/host=default-host:write-attribute(name=default-web-module, value=helloworld.war)

You can also specify as default web module a Web application that is packaged as module in an EAR file by setting the default-web-module attribute. For example:

/subsystem=undertow/server=default-server/host=default-host:write-attribute(name=default-web-module, value=app.ear.demoroot.war)

Which will result in:

<host name="default-host" alias="localhost" default-web-module="app.ear.demoroot.war">
    <location name="/" handler="welcome-content"/>
    <filter-ref name="server-header"/>
    <filter-ref name="x-powered-by-header"/>
</host>

After you have completed the above steps, move to localhost:8080 and check that the Welcome page has been replaced:

jboss change welcome page

Alternatively, you can bind an application in the Root context by setting it into the jboss-web.xml file:

<jboss-web>
    <context-root>/</context-root>
</jboss-web>

JBoss AS 7 / EAP 6

Follow these steps:

1) Disable the Welcome application by running the following command from JBoss CLI:

/subsystem=web/virtual-server=default-host:write-attribute(name=enable-welcome-root,value=false)

2) Configure your Web application to use the root context.
To configure your web application to use the root context (/) as its URL address, modify its jboss-web.xml, which is located in the META-INF/ or WEB-INF/ directory. Replace its <context-root> directive with one that looks like the following.

<jboss-web>
   <context-root>/</context-root>
</jboss-web>

Deploy your application to the server group or server you modified in the first step. The application is now available on http://SERVER_URL:PORT/.

JBoss AS 4-5-6

  • First you have to remove the default Web application that ships with JBoss (ROOT.war).
  • Then deploy your web application taking care to add in your application the file WEB-INF\jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
   <context-root>/</context-root>
</jboss-web>
Found the article helpful? if so please follow us on Socials