问题
I want make permanent redirect from http:// myurl to https:// myurl, but in Jetty I find only MovedContextHandler, with it I can redirect only context path, for examnple from myurl/bla to myurl/bla/bla
<Configure class="org.mortbay.jetty.handler.MovedContextHandler">
<Set name="contextPath">/bla</Set>
<Set name="newContextURL">/bla/bla</Set>
<Set name="permanent">true</Set>
<Set name="discardPathInfo">false</Set>
<Set name="discardQuery">false</Set>
</Configure>
but how can I work with prefix of url?
回答1:
Best handled in your /WEB-INF/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>
来源:https://stackoverflow.com/questions/20611815/redirect-from-http-to-https-in-jetty