Fork me on GitHub
#ring
<
2019-11-04
>
dangercoder18:11:58

Hi, Is it possible to set a cookie on redirect? I have a "/callback"-route which I want to redirect to "/" and set an cookie. I have wrapped my routes with the wrap-cookies middleware. I return this from my callback-route as a response but it does not work. (Redirect works but not cookie).

{:status 302, :headers {"Location" "/"}, :body "", :cookies {:t {:value "1337"}}}

seancorfield18:11:08

@jarvinenemil This is not something that all HTTP clients will honor, even if you can get Ring to do it, so I'd be wary of relying on it.

seancorfield18:11:42

It used to be that some popular browsers ignored cookies on a redirect response. Chromium had a long-standing bug report about this and marked it WontFix / Permanent Bug.

dangercoder18:11:45

Yeah I found the Chromium bug as well. I'll come up with a different strategy