elm-lang / cookie

Would it be better to use the Set-Cookie header?

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The motivating use case

Viir opened this issue · comments

In the case I found, I wanted to know if a user has been using my app the day before. To make this connection between different sessions, I use webbrowser cookies.

I tried the approach of using the Set-Cookie header on an HTTP response. It turned out in that case at least googles chrome browser does not send the cookie with future http requests to the same URL.

Because of this limitation of http cookies, I now use Native code to read and write the cookie.

@Viir no need for native; the withCredentials flag on Http.request enables exactly this use-case: persistence of information on the client without your app having direct access to it.

@zwilias, thank you, this is very interesting. I will try using withCredentials to make cookies work with HTTP.

Setting the withCredentials flag on the HTTP requests made the browser send the cookies, so I consider this issue solved.