通过 tomacat8 和 Struts2 的 SSL

SSL over tomacat8 and Struts2

我有一个 运行 服务器 Tomcat 8,带有这个连接器:

<Connector connectionTimeout="20000" port="80" protocol="HTTP/1.1" redirectPort='443"/>


<Connector SSLEnabled="true" URIEncoding="UTF-8" clientAuth="false" 
            connectionTimeout="20000" keystoreFile="path" 
            keystorePass="pwd" maxThreads="150" port="443" protocol="HTTP/1.1" scheme="https" secure="true" sslProtocol="TLS"/>

我知道它可以工作,因为我有一个网络应用程序 struts1-基于它并且重定向工作正常。

我正在使用 struts2 开发一个新的网络应用程序,但它不起作用。我做了一些研究,但我不明白是否必须在应用程序上进行一些更改(设置)(struts.xml、web.xml...),这一切都取决于 Tomcat重定向。

有人可以帮助我吗?

谢谢

不断搜索,我找到了解决方案

http-->https重定向只需要tomcat配置;无需应用程序设置

除server.xml中的连接器外,在web.xml

中添加
<security-constraint>
        <web-resource-collection>
            <web-resource-name>Entire Application</web-resource-name>
            <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <user-data-constraint>
            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
    </security-constraint>

来源:here