0 Replies Latest reply on Feb 18, 2016 6:30 AM by Route nl

    How to use 301 redirect when redirecting all http --> https

    Route nl Newbie

      Hi,

       

      Recently, we are enabling SSL on our Wildfly instance. We used this StackOverflow answer to configure our Wildfly instance for SSL. This includes the management interface and the webserver itself. Now, to get a better rating in Google search, we want to apply SEO methods for SSL.

       

      We now want to redirect all http traffic to https to comply to Google's specification. We use the following web.xml snippet for this:

       

          <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 works, however this results in a 302 temporary redirect. To preserve our old score on our URL's, this needs to be a 301 permanent redirect. Is there a way to accomplish this with Wildfly/Undertow/Web.xml ?

       

      Thanks in advance.