0

I got a cookie being set in the response header, however my browser doesn't store the cookie. The front-/back-end components run on localhost:8080/8082 respectively.

Using node v5+, express v4+ and tried both connect-mongo/connect-redis

Chrome v. 52.0.2743.82

Even though Chrome is supposed to play nicely with cookies from domain=localhost for quite some time now, I still tried to create a PTR in the /etc/hosts file like 127.0.0.1 local.com, no difference.

Here is the set of header fields that I see in the response:

enter image description here

I tried disabling httpOnly flag, still the same.

Nikolay Melnikov
  • 1,395
  • 1
  • 15
  • 25

1 Answers1

1

Figured it out after reading the following article, this section in particular. Kudos to Mozilla folks!

On the node side I added:

res.header('Access-Control-Allow-Credentials', 'true');

In the axios.pos I added the following key:value pair in the config part:

{withCredentials: true}

Cheers

Nikolay Melnikov
  • 1,395
  • 1
  • 15
  • 25