Wildfly 10 https redirection

In Wildfly server can we redirect request from http to https through the undertow subsystem (standalone.xml or domain.xml).

In standalone.xml or domain.xml files

To do this redirection we need to create a filter to rewrite url.

<filters>
  <rewrite name="http-to-https" redirect="true" target="https://domainname:8448%U" />
</filters>

Once the filter is created, create the filter reference to configure a predicate that decides when the filter will be applied.

<server name="default-server">
   <host name="default-host" alias="localhost">
      ...
      <filter-ref name="http-to-https" predicate="equals(%p,8080)"/>
      ...

With JBoss CLI

/subsystem=undertow/configuration=filter/rewrite=http-to-https:add(redirect="true",target="https://myhostname:8443%U")
/subsystem=undertow/server=default-server/host=default-host/filter-ref=http-to-https:add(predicate="equals(%p,8080)")