javascript - express about setting and getting cookies
PHP中文网
PHP中文网 2017-07-05 10:55:52
0
1
834

1. The cookie can be set successfully, but why can’t it be obtained? req.cookies has always been {}
The relevant parsing cookie npm package has been referenced

and the setting is successful.

But when I refresh to get req.cookies, it is always {}. This is why. . . ? ? ?

(1). Debugging is local environment debugging

PHP中文网
PHP中文网

认证高级PHP讲师

reply all (1)
黄舟

Are the client and server cross-domain?
Cross-domain requests will not automatically bring cookies. You will know by looking at the Request Headers of the network.
If you want to bring cookies with cross-domain requests, ajax must set withCredentials: true

    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!