Cookie的跨域共享
来源:互联网 发布:千金方医药软件 编辑:程序博客网 时间:2024/06/05 05:02
这两天遇到了域名切换的问题,因为需要域名的兼容,尝试创建多份cookie,将cookie种在不同的域上,尝试了下,单纯从后端进行改动是没办法实现的。
查阅相关资料,了解了cookie的domain限制,看RFC-6265中对domain match的介绍
A string domain-matches a given domain string if at least one of the following conditions hold: o The domain string and the string are identical. (Note that both the domain string and the string will have been canonicalized to lower case at this point.) o All of the following conditions hold: * The domain string is a suffix of the string. * The last character of the string that is not included in the domain string is a %x2E (".") character. * The string is a host name (i.e., not an IP address).
这里对cookie domain的就是浏览器在向request中写入cookie以及从response中向浏览器中存储cookie时,进行的限制。就是cookie的域当前url域名的关系,必须满足下面两个条件之一才行:
cookie domain和url完全相同(经过转小写处理后)
必须满足下面的所有条件
2.1 cookie域是url的后缀
2.2 url去掉cookie domain部分后,最后一个字符必须是 . (dot)
2.3 url是域名,不是IP地址。
因此纯粹从后端实现cookie的跨域共享不太可能(能实现的话,这就是一个超级大的安全漏洞了),可以通过前端+后端的方式共同实现,eg:
阅读全文
0 0
- COOKIE 的跨域共享
- Cookie的跨域共享
- 跨域共享Cookie
- cookie跨域共享
- Cookie跨域共享
- 跨域共享cookie
- 跨域共享cookie
- 在同一台应用服务器内共享cookie和跨域共享cookie的方法
- 实现跨域cookie共享
- 实现跨域cookie共享
- 解决跨域cookie共享
- 实现跨域cookie共享
- 实现跨域cookie共享
- [跨域] -- cookie跨域共享
- passport登陆的实现--跨域共享cookie和跨域共享session
- cookie用法小结 cookie.setPath 跨域共享
- 实现跨域cookie共享(转载)
- jquery.cookie中的操作(跨域共享)
- 3.Json获取值的方式是data.key
- 关于php的cgi,php-fpm的关系
- c++内存模型------计算机系统核心概念及软硬件实现
- dhcp6c
- Android 一一 Intent在活动之间穿梭
- Cookie的跨域共享
- 算法排序(3):选择排序
- Prime Path
- Ajax的Post提交与Get提交的不同方式
- 51Nod 1445
- Codeforces812C Sagheer and Nubian Market(贪心+二分)
- 数据可视化
- 深入解析HashMap、HashTable
- 作业代码