在Jetty中从http重定向到https

编程入门 行业动态 更新时间:2024-10-27 04:38:37
本文介绍了在Jetty中从http重定向到https的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想从myurl永久重定向到myurl,但是在Jetty中,我只找到MovedContextHandler,有了它我只能重定向上下文路径,例如从myurl/bla到myurl/bla/bla

I want make permanent redirect from myurl to 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>

但是如何使用url前缀?

but how can I work with prefix of url?

推荐答案

最好在您的/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>

更多推荐

在Jetty中从http重定向到https

本文发布于:2023-11-01 19:47:11,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550239.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:重定向   Jetty   http   https

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!