Angular HTTP4.4.3 CSRF和CORS

Angular HTTP4.4.3 CSRF和CORS,angular,cross-domain,csrf,Angular,Cross Domain,Csrf,CORS设置如何与Angular的XSRF保护配合使用?绝对URL被忽略,但我也需要XSRF来处理绝对URL。这不应该通过HttpClientXsrfModule.withOptions()配置吗?这似乎是代码中的一个疏忽 具体来说,我在角度代码中看到了这一点: 我认为任何XHR请求都不能从不同的域访问cookie,因为angular中CSRF的方法是读取cookie,它必须在同一个域中。即使它是javascript可读的,xhr.getResponseHeader(“Set Cookie”)

CORS设置如何与Angular的XSRF保护配合使用?绝对URL被忽略,但我也需要XSRF来处理绝对URL。这不应该通过
HttpClientXsrfModule.withOptions()
配置吗?这似乎是代码中的一个疏忽

具体来说,我在角度代码中看到了这一点:


我认为任何XHR请求都不能从不同的域访问cookie,因为angular中CSRF的方法是读取cookie,它必须在同一个域中。即使它是javascript可读的,xhr.getResponseHeader(“Set Cookie”)也是不可读的,所以我不确定它是如何工作的
// Skip both non-mutating requests and absolute URLs.
// Non-mutating requests don't require a token, and absolute URLs require special handling
// anyway as the cookie set
// on our origin is not the same as the token expected by another origin.
if (req.method === 'GET' || req.method === 'HEAD' || lcUrl.startsWith('http://') ||
    lcUrl.startsWith('https://')) {
  return next.handle(req);
}