You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
x-xsrf-token: token is added even for other origins. #15052
[x] bug report => search github for a similar issue or PR before submitting
[ ] feature request
[ ] support request => Please do not submit support request here, instead see https://github.com/angular/angular/blob/master/CONTRIBUTING.md#question
Current behavior
x-xsrf-token: token is added even for other origins Expected behavior
it should not added if URL origin is different.
Minimal reproduction of the problem with instructions
For clarification: same origin should be determined by cookie's domain value (i.e. run.plnkr.co in your example). Thing is: we cannot read domain value in JavaScript, right?
(thinking loud)
Is it enough to do same-origin check for the URL of the request? XHR is cross-origin when URL starts with either http: or https: or //. If URL starts with anything else, request can be considered same origin.
However, this will potentially break sub-domain set ups (e.g. cookie set for .domain.com, XHR to //sub.domain.com/foo). Given the definition of origins for cookies, we'd need to extract the domain + public suffix (e.g. domain.co.uk) and check whether document.domain is same domain or sub-domain of this?
Activity
DzmitryShylovich commentedon Mar 9, 2017
Please fill out the issue template. thanks
bhoomabrsr commentedon Mar 9, 2017
Updated with template.
dherges commentedon Apr 24, 2017
For clarification: same origin should be determined by cookie's domain value (i.e.
run.plnkr.coin your example). Thing is: we cannot read domain value in JavaScript, right?(thinking loud)
Is it enough to do same-origin check for the URL of the request? XHR is cross-origin when URL starts with either
http:orhttps:or//. If URL starts with anything else, request can be considered same origin.However, this will potentially break sub-domain set ups (e.g. cookie set for
.domain.com, XHR to//sub.domain.com/foo). Given the definition of origins for cookies, we'd need to extract the domain + public suffix (e.g.domain.co.uk) and check whetherdocument.domainis same domain or sub-domain of this?zenlambda commentedon Jun 10, 2017
Is there a work around for this? (Besides using XHR or fetch).
alxhub commentedon Dec 5, 2017
This is fixed in
HttpClient.angular-automatic-lock-bot commentedon Sep 12, 2019
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
This action has been performed automatically by a bot.