【发布时间】:2020-03-24 04:00:59
【问题描述】:
在 Quarkus 中从 HTTP 重定向到 HTTPS 的最简单方法是什么?
我搜索了配置文档https://quarkus.io/guides/all-config,但找不到任何东西。
我尝试添加 undertow 依赖项和 web.xml 以强制建立 https 连接。我添加的 web.xml 如下所示:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<security-constraint>
<web-resource-collection>
<web-resource-name>All</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>
【问题讨论】:
-
到目前为止你有什么尝试?
-
我尝试添加 undertow 依赖项和 web.xml 以强制建立 https 连接。我还尝试查找
http.disable或https.only等配置参数。 -
这最好由您的应用服务器完成,而不是您的代码。
标签: java jakarta-ee quarkus