HTTP to HTTPS redirection in JBOSS EAP 6.4: change domain name?

Posted on

I have configured my web application to redirect all HTTP URL requests to HTTPS URL by making following changes:

1) Changes in standalone.xml:

<subsystem xmlns="urn:jboss:domain:web:2.2" default-virtual-server="default-host" native="false">
    <connector name="http" protocol="org.apache.coyote.http11.Http11NioProtocol" scheme="http" socket-binding="http"/>
    <connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">
        <ssl name="https" key-alias="appname" password="changeit" certificate-key-file="path_to_jks"/>
    <virtual-server name="default-host" enable-welcome-root="false">
        <alias name="localhost"/>
        <rewrite name="test" pattern="^:http_port/(.*)" substitution="$1" flags="RL"/>

2) Changes in web.xml:

        <web-resource-name>HTTPS Constraint</web-resource-name>

My applications HTTP URL is:


My certificate file contains FQDNs (fully qualified domain names). So my HTTPS URL looks like:

With current configuration, whenever user invokes HTTP URL (http://hostname:http_port), browser redirects it to:


But I want URL instead to redirect to:

How do I do it? JBOSS version is EAP 6.4. JDK version is 1.7. Application is deployed on RHEL server. I can not set enable-welcome-root=true in standalone xml as I do not wish to change my application URL with additional contaxt.

Please let me know if you need more information.