gpt4 book ai didi

scala - Safari 未发送 Play session cookie

转载 作者:行者123 更新时间:2023-12-01 06:36:33 25 4
gpt4 key购买 nike

我在域 a.domain.com (http) 上有一个单页应用程序 (SPA),它连接到在 Play 2 (scala) 中构建的 b.otherdomain.com (https) 上的 api。

加载 SPA 后,用户输入凭据,应用程序向 https://b.otherdomain.com.com/login 发出 ajax 调用。 .

/login 设置了 Play cookie,下面的请求经过了很好的验证。
一切都在 Chrome 和 Firefox 上运行(由于 CORS 限制,IE 无法运行)。

它应该在 Safari 上工作,但在/login 调用之后,cookie 不会与以下请求一起发回,因此 Play 返回“401 未授权”响应。

这是我服务器端的错误还是配置错误?
我是否必须更改 application.session.httpOnly 和 application.session.secure ?

这是我从 Safari 检查器中看到的:

/login headers :

URL de la requête:https://b.otherdomain.com//login
Méthode de la requête:POST
Code d’état:200 OK
En-têtes de requêteafficher la source
Accept:application/json, text/plain, */*
Content-Type:application/x-www-form-urlencoded
Origin:http://a.domain.com.com
Referer:http://a.domain.com/
User-Agent:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2
Données du formulaireafficher l’URL codée
email:foo@foo.com
password: foofoo
En-têtes de réponseafficher la source
Access-Control-Allow-Credentials:true
Access-Control-Allow-Origin:http://a.domain.com
Connection:keep-alive
Content-Length:31
Content-Type:text/plain; charset=utf-8
Set-Cookie:PLAY_SESSION=a71f93e3315fa9164dd7112841ccdb4a0f0c447b- sessionId%3A6gtu7%21z.5i%218d%29v8yxy693n-s6zsuejpav_p67f9hb%7Ej%274h2de*jx3g35p%7Egzo0u;Path=/;HTTPOnly
Strict-Transport-Security:max-age=31536000

following request :

URL de la requête:https://b.otherdomain.com/users
Méthode de la requête:GET
Code d’état:401 Unauthorized
En-têtes de requêteafficher la source
Accept:application/json, text/plain, */*
Origin:http://a.domain.com
Referer:http://a.domain.com/
User-Agent:Mozilla/5.0 (Windows NT 6.1) AppleWebKit/534.57.2 (KHTML, like Gecko) Version/5.1.7 Safari/534.57.2
En-têtes de réponseafficher la source
Access-Control-Allow-Credentials:true
Access-Control-Allow-Origin:http://a.domain.com
Connection:keep-alive
Content-Length:24
Content-Type:text/plain; charset=utf-8
Strict-Transport-Security:max-age=31536000

最佳答案

我有同样的问题。它在 Chrome 中运行良好,但在 Safari 中则完全没有。我的理解是,这是与 third party Cookies 相关的 Safari 的新限制。 .

似乎没有(好的)解决方法。

选项 :
- 使用代理:服务器 a 上的设置和端点调用 b 服务器端。
- 为 b 创建一个 c-Name DNS 条目,使其被视为 a

您可能想尝试 PayPal 跨域套件:https://medium.com/@bluepnume/introducing-paypals-open-source-cross-domain-javascript-suite-95f991b2731d

关于scala - Safari 未发送 Play session cookie,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14256455/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com