我正在尝试使用从attacker.local到defender.local的提取来发出跨域AJAX请求,并且我希望该请求包含在defender.local上设置的cookie。
我已遵循本指南:https://stackoverflow.com/a/67001424
https://defender.local已使用此标头设置cookie:
Set-Cookie: secure-cookie=secure-cookie-value; Max-Age=86400; Domain=.defender.local; Path=/; Expires=Sat, 21 Sep 2024 16:50:02 GMT; Secure; SameSite=None
我的获取请求(来自attacker.local)是通过以下方式完成的:
fetch('https://defender.local', {
method: 'post',
credentials: 'include',
});
defender.local 使用这些标头进行响应:
Access-Control-Allow-Origin: https://attacker.local
Access-Control-Allow-Credentials: true
使用 Chrome v129 发出此请求可以,但使用 Firefox v130 则不行。
为什么POST请求中不包含cookie?