Set-Cookie in Response Header not being set in browser

Viewed 1190

I am having issues with trying to set a cookie from a Response Header, I can see the set-cookie key with all the options that i have specified but for some reason it is not being set in the browser (Chrome).

I am setting the cookie using koajs, and reads as follows:

this.cookies.set(’test-cookie’, ‘valid’, { domain: ‘.test.io’, httpOnly: false, maxAge: 604800000 })

this is what I get in the response:

GET https://api.test.io/conversion

set-cookie: test-cookie=valid; path=/; expires=Mon, 12 Jun 2017 14:23:40 GMT; domain=.test.io;

I have another request (GET https://identity.test.io/identity) that does a similar request and has the same set-cookie response and i can see this cookie in chrome dev tools.

The only difference is api.test.io goes through several redirects (301), however we do not think that is the issue as we still see the set-cookie key in the final response header.

nb: this cookie needs to work across multiple sites which is why we don’t set secure, signed or httpOnly.

1 Answers

My answer is strictly for local testing, but I am putting it here as an answer cause your question is exactly what I searched for before I fixed it.

My php.ini file had the session.auto_start setting set to 0. I set it to 1, and the browser started saving cookies that were in response header. (using WAMP with PHP 7.0.29)

Related