因此,我有两个站点 http://localhost/ 和 http://3rdPartyLocallyHostedAPI/(不是真实姓名)- 都是本地 Intranet 站点,并且由于同名的性质,必须向它发出3rdPartyLocallyHostedAPI
CORSlocalhost
请求.
这些请求工作正常,数据返回或可以3rdPartyLocallyHostedAPI
按预期发布到,但是显示此警告:
与 http://3rdPartyLocallyHostedAPI/ 上的跨站点资源关联的 cookie 设置时没有该
SameSite
属性。SameSite=None
Chrome 的未来版本将仅在设置了和的情况下为跨站点请求提供 cookieSecure
。您可以在应用程序>存储>Cookie 下的开发人员工具中查看 cookie,并在https://www.chromestatus.com/feature/5088147346030592和https://www.chromestatus.com/feature/5633521622188032查看更多详细信息。
现在,我查看了多个答案,例如这个,这个和这个说明需要在服务器上设置 SameSite 属性的答案,这没有任何意义,因为它所使用的两个 cookie 有问题 (ss -pid 和 ss-id) 在请求中设置,没有在响应中返回?这让我感到困惑,因为我不知道如何或在何处进行更改以确保将这些 cookie 上的 SameSite 策略设置为none
或secure
。
我认为是执行 AJAX 请求的 jQuery 出了问题:
// trimType and queryValue are determined elsewhere by some jQuery selections, their values are not important to the question being asked.
$.ajax({
url: 'http://3rdPartyLocallyHostedAPI?q=' + trimType + '?q=' + queryValue + '&resultsOnly=true',
data: {
properties: (trimType === 'Record') ? 'Title,Number,RecordRecordType' : 'NameString'
},
xhrFields: {
withCredentials: true
},
dataType: 'json'
}).done(function (data) {
if (data.Results.length > 0) {
$resultsPane.html('');
for (var i = 0; i < data.Results.length; i++) {
// Not relevant to the question being asked so removed, only some jQuery in here to display results on page.
}
} else {
$resultsPane.html('<p class="py-1 pl-1 list-group-item text-muted">No Results found.</p>');
}
}).fail(function () {
$resultsPane.html('<p class="py-1 pl-1 list-group-item text-muted">No Results found.</p>');
});
哈士奇WWW
相关分类