5

I have enabled https changing standalone.xml as follows:

 <security-realms>

        <security-realm name="UndertowRealm">  
            <server-identities>  
                <ssl>  
                    <keystore path="./ed.keystore" relative-to="jboss.server.config.dir" keystore-password="secret" alias="ed" key-password="secret" />  
                </ssl>
            </server-identities>  
        </security-realm> 
        ...

and:

<subsystem xmlns="urn:jboss:domain:undertow:1.2">
        <buffer-cache name="default"/>
        <server name="default-server">
            <http-listener  name="default" socket-binding="http" redirect-socket="https" />
            <https-listener name="https"   socket-binding="https" security-realm="UndertowRealm" />

Both the following links work:

the second actually is a secure connection.

Unfortunately, the first link doesn't redirect to the https protocol.

What have I missed?

Thank you.

Fab
  • 1,468
  • 1
  • 16
  • 37

1 Answers1

6

Make sure you add this in your web.xml

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

This will allow the redirection for any URL.

Jean-François Savard
  • 20,626
  • 7
  • 49
  • 76