Reputation: 51
Hello I am trying to setup a permanent redirect (301) from http to https in jetty 9. The solution I found everywhere is to add the following in my web.xml
<security-constraint>
<web-resource-collection>
<web-resource-name>Everything</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>INTEGRAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
This sets up a 302 redirect and not a 301 redirect and it is a big issue, anyone know how I could change this to a 301 redirect ?
Upvotes: 0
Views: 692
Reputation: 696
I think you make a mistake in transport guarantee so you have to put this instead
In your WEB-INF/web.xml
<security-constraint>
<web-resource-collection>
<web-resource-name>Everything</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
In a Jetty XML
<Call name="addConnector">
<Arg>
<New class="org.eclipse.jetty.nio.SelectChannelConnector">
...
<Set name="confidentialPort">443</Set>
</New>
</Arg>
</Call>
Upvotes: 1