AymaxLi / AymaxLi.github.io

:point_right: my blog,show in issues ~

Home Page:https://github.com/AymaxLi/AymaxLi.github.io/issues

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

iOS 微信浏览器或 Safari 跨域请求 cookie 丢失

AymaxLi opened this issue · comments

commented

Background

这周回实验看看师弟师妹,她们说遇到一个 cookie 丢失的问题。

Detail

确认了一下场景如下

  • 环境: iOS 微信浏览器 or Safari
  • 现象:跨域请求 cookie 丢失
    首先,一般浏览器的跨域请求设置了 withCredentials = true 之后就能带上 cookie ,所以安卓和 PC 是没有问题的,然而 iOS 的这个系统向来比较看重安全,要用户手动设置允许才行 😓。。。。

Solution

然鹅,我们肯定不能让用户去手动设置允许滴,所以我就曲线救国一下,帮她们配置一下 nginx,把前端页面和后端应用代理到同一个域下就好了。🌝