Fork me on GitHub
#ring
<
2022-12-19
>
robert-stuttaford16:12:53

what could cause ring cookies to produce a new session cookie-store encrypted value on each request? when i watch the cookie in Chrome, the value changes every refresh. the actual behaviour is fine - my session is working and my app does what i want. just seems odd that it keeps making a new value each time

Hukka18:12:35

https://github.com/ring-clojure/ring/blob/1.9.0/ring-core/src/ring/middleware/session.clj#L61 hm, the logic is there. But hard to say what could be changing the :session-cookie-attrs, or put the :recreate key in the response

Hukka18:12:07

Could something be setting the session age, for example, all the time?

Hukka18:12:14

I don't think core ring has anything that sets those, so it should be in other parts

Hukka18:12:22

You could start by printing the relevant parts of the response right before the session middleware checks it, so you know which path it goes down to

Hukka18:12:47

Then move your debug middleware up layer by layer, so you catch where it happens

Hukka18:12:01

(or if the stack is deep, binary search 😉

dharrigan13:12:18

Are you using reitit?

robert-stuttaford13:12:22

we also have a lib-noir server (from years ago) that we're still using and its cookie value is stable from page to page, so i lost half a day trying to figure out why, until i recognised that the session was still working as i wanted it to

dharrigan13:12:21

What I had to do was to have a global store, and not put the wrap-session in the route middleware.

robert-stuttaford14:12:58

oh interesting, going to give that a close read

robert-stuttaford14:12:23

also i should read Issue logs 😅

robert-stuttaford15:12:04

thanks for this, i don't have this specific issue; i implemented my own interceptor instead of using their middleware

dharrigan18:12:44

np, glad you sorted it out 🙂