Refused to set unsafe header 'Cookie'
See original GitHub issueconst request = axios.create({ baseURL: ‘http://www.someurl.com/’, headers: { ‘Cookie’: ‘some_string_value’ } });
throws an error Refused to set unsafe header 'Cookie'
Issue Analytics
- State:
- Created 7 years ago
- Comments:10 (1 by maintainers)
Top Results From Across the Web
Refused to set unsafe header "Cookie" error in browser yet ...
You get that error from Chrome because, per the XHR specification, the setRequestHeader method should not set headers with a forbidden ...
Read more >Refused to set unsafe header "Cookie" - Syncfusion
Refused to set unsafe header "Cookie". I am attaching the ASP.NET Identity cookie and passing it to the controller as the domain name...
Read more >jQuery : Cookie Header in PhoneGap: Refused to set unsafe ...
jQuery : Cookie Header in PhoneGap: Refused to set unsafe header " Cookie " [ Beautify Your Computer ...
Read more >axios set cookie in header | The AI Search Engine You Control
As it seems, it is not possible to read the Set-Cookie header via Axios, as @jub0bs pointed out. ... "refused to set unsafe...
Read more >Use of Cookie header for authentication means that remote ...
You can not set the 'Cookie' header when making a XMLHttpRequest. Attempting to do so results in a 'Refused to set unsafe header...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@samayo Your axios header should look like this:
In your Javascript code: const axiosConfig = { headers: { ‘content-Type’: ‘application/json’, “Accept”: “/”, “Cache-Control”: “no-cache”, “Cookie”: document.cookie }, credentials: “same-origin” }; axios.defaults.withCredentials = true; axios.get(‘/url’, axiosConfig) .then((res) => { // Some result here }) .catch((err) => {
console.log(‘😦’); });
I hope it helps…
Thanks @joembaya, I have looking for the answer since August 2017 😃