Skip to content Skip to sidebar Skip to footer

How To Make The Browser Include The Cookies Of The Domain Of The Host Origin When Making A Cross-origin Http Request

I made a cross-origin HTTP request from the website 'demo.home.com' to 'demo.company.com' using the Fetch api with the credentials set to 'include'. There are two cookies. One is '

Solution 1:

You can't. fetch (and XMLHttpRequest) provide no mechanism to manually set cookies in a request.

They'll only send cookies in the browser's cookie jar for the target URL. This applies the normal rules for which domain a cookie belongs to.

You need to use some other mechanism to send the data you would store in the cookies.

Post a Comment for "How To Make The Browser Include The Cookies Of The Domain Of The Host Origin When Making A Cross-origin Http Request"