我们强制使用安全约束策略将http重定向到https。尽管在本地开发中,我们希望消除这种限制。对于Jetty 7,我们使用的是override-web.xml
,它将传输安全性从机密重新分配到零。现在,当我们迁移到Jetty 9之后,它突然停止了。我怀疑现在使用Jetty 9而不是覆盖传输安全性,它增加了列表的约束。
如何在本地环境中覆盖从机密到无的安全约束?
这是来自web.xml
的部分
<security-constraint>
<web-resource-collection>
<web-resource-name>Some server</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
在本地开发中,我们使用jetty插件运行jetty,并指定override-web.xml
。这是来自override-web.xml
的部分
<security-constraint>
<web-resource-collection>
<web-resource-name>Some server</web-resource-name>
<url-pattern>/*</url-pattern>
</web-resource-collection>
<user-data-constraint>
<transport-guarantee>NONE</transport-guarantee>
</user-data-constraint>
</security-constraint>
前版本: 7.6.10.v20130312
后版本: 9.2.18.v20160721
发布于 2017-01-23 09:24:11
这个功能应该在Jetty 9
中工作,就像在Jetty 7
中一样。
您可以从WebApp configuration
找到这里指令
他们在Jetty 9
中稍微更改了标记,所以在读取配置时要格外小心。你应该在你的pom.xml
里有这样的东西
<configuration>
<webApp>
<overrideDescriptor>{path_to_your_override_xml}</overrideDescriptor>
</webApp>
</configuration>
例如,标记
<webApp> </webApp>
更早
<webAppConfig> </webAppConfig>
遵循Jetty startup log
并验证是否应用了重写:
[INFO] Web overrides = {path_to_your_override_xml}
https://stackoverflow.com/questions/41721127
复制相似问题