axios sends request without cookies - Stack Overflow
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-19 10:20:19
0
1
523

After switching to axios, I found that the cookie was not automatically carried in the request sent (jQuery would bring it itself), like this

Because the backend needs to use cookies I have made some judgments, but I have never found a way to automatically (manually do) carry cookies in axios. Ask the experienced driver to lead the way. (ps: I saw someone talking about the axios.defaults.withCredentials = true configuration before, but it didn’t work after trying it)

I found the reason. It's not that axios doesn't work, but the cookie path problem. As follows:
The previous cookie has been saved as early as /m, but there is no /m when requesting


So there is no cookie in the header of the request. If you want to use the cookie, you must write it at the same level. Set the path when writing the cookie, and the problem will be solved.

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(1)
世界只因有你

The questioner solved it by himself, thank you.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!