跨域cookie设置

跨域cookie设置,第1张

概述1.后端设置  Access-Control-Allow-Credentials 设置为true  设置:Access-Control-Allow-Origin   2.前端设置 设置:withCredentials: true 以axios为例:在request config中设置:withCredentials: true 以上参考:https://stackoverflow.com/ques

1.后端设置

 Access-Control-Allow-Credentials 设置为true

 设置:Access-Control-Allow-Origin

 

2.前端设置

设置:withCredentials: true

以axios为例:在request config中设置:withCredentials: true

以上参考:https://stackoverflow.com/questions/46288437/set-cookies-for-cross-origin-requests

3.设置domain的问题:.

参考:https://stackoverflow.com/questions/1134290/cookies-on-localhost-with-explicit-domain?answertab=votes#tab-top

31.如果@R_502_5556@s中的domain有端口信息,Chrome浏览器会自动过滤掉这个@R_502_5556@。

3.2.按设计,domain 必须有至少两个点,否则浏览器会认为该domain是非法的。

3.3.在localhost上,domain应该省略,设置为null、‘’,flase 不够

 

可以尝试不设置domain,或者是为null、‘’、false

我设置了domain为null,可以;具体原因不知。

总结

以上是内存溢出为你收集整理的跨域cookie设置全部内容,希望文章能够帮你解决跨域cookie设置所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1066415.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-26
下一篇2022-05-26

发表评论

登录后才能评论

评论列表(0条)

    保存