Fab
Fab

Reputation: 1564

Wildfly 8.2.0 Doesn't redirect to https

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.

Upvotes: 5

Views: 4465

Answers (1)

Jean-Fran&#231;ois Savard
Jean-Fran&#231;ois Savard

Reputation: 21004

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.

Upvotes: 6

Related Questions