Ssl – Jetty 9 – redirect http to https

httphttpsjettyredirectssl

I'd like to force use of https in Jetty 9. Apparently:

<Set name="confidentialPort">443</Set>

no longer works in jetty 9. How should I do it properly?

Best Answer

This resource says to add this to your web.xml

<web-app>
  ...
  <security-constraint>
    <web-resource-collection>
      <web-resource-name>Everything in the webapp</web-resource-name>
      <url-pattern>/*</url-pattern>
    </web-resource-collection>
    <user-data-constraint>
      <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
  </security-constraint>
</web-app>