10 Replies Latest reply on Apr 7, 2017 6:59 AM by Amit Kumar

    Redirect HTTP to HTTPS in JBoss AS 7.1.1

    Cristian Miranda Newbie

      Hi,

       

           I have a web application hosted in JBoss AS 7.1.1. I want to redirect every HTTP access to HTTPS.

           I've read the documentation and did the following:

       

           1. Generated SSL certificate (file named chap8.keystroke)

           2. Added connectors in standalone.xml (Note: I have 8888 for HTTP and 8443 for HTTPS in my socket binding)

       

      <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" enable-lookups="false" secure="true">
            <ssl name="ssl"
                 key-alias="chapter8"
                 password="rmi+ssl"
                 certificate-key-file="../standalone/configuration/chap8.keystore"
                 protocol="TLSv1"
                 verify-client="false"/>
      </connector>
      
      

       

           3. Added security constraint in web.xml

       

          <security-constraint>
              <web-resource-collection>
                  <web-resource-name>SECURE</web-resource-name>
                  <url-pattern>/*</url-pattern>
              </web-resource-collection>
              <user-data-constraint>
                  <transport-guarantee>CONFIDENTIAL</transport-guarantee>
              </user-data-constraint>
          </security-constraint>
      
      

       

           In spite of all the configuration, when I access my application through HTTP port (http://localhost:8888/App.html) it is not redirected to HTTPS. On the other hand, if I access through HTTPS it works. So SSL is enabled, the only problem is the redirect from HTTP to HTTPS.

       

      These are the things I've tried:

       

          Am I missing something in the configuration? Any ideas?

       

      Thanks