2 Replies Latest reply on Nov 3, 2014 8:16 AM by Gurushant Birajdar

    How to Auto Redirect http to https with 8.1?

    Tim Snyder Newbie

      With Jboss AS 7.1.1 I successfully set up all connections to auto redirect to https via the following configuration

        <subsystem xmlns="urn:jboss:domain:web:1.1" default-virtual-server="default-host" native="false">


            <jsp-configuration x-powered-by="false" display-source-fragment="false"/>


          <connector name="http" protocol="HTTP/1.1" scheme="http" socket-binding="http" redirect-port="8443"/>

          <connector name="https" protocol="HTTP/1.1" scheme="https" socket-binding="https" secure="true">

            <ssl name="xxxx-ssl" key-alias="vault" password="xxxxxx" certificate-key-file="../standalone/configuration/xxxxxxx.keystore" cipher-suite="HIGH" protocol="TLSv1" verify-client="false"/>


          <virtual-server name="default-host" enable-welcome-root="false">

            <alias name="localhost"/>



      And then placing the keystore in the configuration folder.


      I am upgrading the dev project to wildfly 8.1 and can not find an example or documentation on how to accomplish the same thing with undertow configuration. Anybody have an example or information on how to accomplish this?

        • 1. Re: How to Auto Redirect http to https with 8.1?
          Tim Snyder Newbie

          I figured it out. The steps are in standalone.xml:


          1) Added the https-listener as default. Note - had to change the http-listener name, and add a servlet-container for that name.

          <subsystem xmlns="urn:jboss:domain:undertow:1.1">

            <buffer-cache name="default"/>

            <server name="default-server">

               <http-listener name="http-default" socket-binding="http"/>

               <https-listener name="default" socket-binding="https" security-realm="ssl-realm"/>

               <host name="default-host" alias="localhost">

                 <location name="/" handler="welcome-content"/>

                 <filter-ref name="server-header"/>

                 <filter-ref name="x-powered-by-header"/>



             <servlet-container name="http-default">





          2) Created a security-realm by copying pasting the ApplicationRealm and naming it ssl-realm as defined within the https-listener. Then added ssl element as below.


          <security-realm name="ssl-realm">



                <keystore path="../standalone/configuration/xxxxxx.keystore" keystore-password="xxxxxxx" alias="xxx"/>





          It now works to redirect all http requests to https

          • 2. Re: How to Auto Redirect http to https with 8.1?
            Gurushant Birajdar Newbie

            @Tim Snyder,


            My question is, how do I redirect only those http requests to https, which came from port 80 or 8080. If user have set http port other than 80 or 8080, then it should not redirect to https.