http不能设置cookies问题
我在配置https后发现,https和http协议不能同时存在,本地使用http协议通信没有问题,但是如果启动了docker容器中的项目,就会出现问题,http通信的项目会出现cookies无法使用,在一番搜索下下找到了答案
参考资料地址
https://blog.csdn.net/fatherican/article/details/46971449
因为我在配置https的时候配置了一个安全认证
<!--<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>--> |
拦截所有的请求其中
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
有三个参数分别如下
NONE、INTEGRAL、CONFIDENTIAL。
NONE表示被指定的Web资源不需要任何传输保证;
Integral表示客户机与服务器之间传送的数据在传送过程中不会被篡改;
Confidential表示数据在传送过程中被加密。
大多数情况下,INTEGRAL或CONFIDENTIAL是使用SSL实现。
因为docker容器中的项目使用了ssl,但是本地项目使用的普通的http协议,但是浏览器因为tomcat安全认证的原因已经被设置为要求数据必须加密,导致了http协议的cookies设置不上,应该是http协议下数据没有加密,也就不符合浏览器的设置,无法向coolies中添加未加密的数据。