Issues
I use ember at cliend, and start on localhost:4200; sinatra at server, start on localhost:9292.
Then I use response.set_cookie()
to store user info, but I cannot see cookie setted just now on chrome console -> resource -> cookies -> localhost
.
cliend code:
1 2 3 |
|
cliend code:
1 2 3 4 5 6 |
|
Solution
Option in ajax:
1 2 3 |
|
Response header in sinatra, Access-Control-Allow-Credentials: true
, Access-Control-Allow-Origin: http://localhost:4200
Important
Don’t set localhost as a domain for your cookies because you need to set it to “” or FALSE