Fork me on GitHub
#ring
<
2022-01-09
>
thumbnail21:01:41

Hey! I'm looking into sessions with ring, and can't get the cookie and session middleware to play nice together. Especially when using a custom cookie encoder/decoder. The session middleware will set the :cookies-key preventing the cookie middleware from decoding the cookies. If I switch the session / cookies middleware around the cookies are decoded properly, but the session cookie won't be read using the correct encoder/decoder. I believe this is because the session-middleware calls the cookies/cookies-request and cookies/cookies-response functions instead of relying on the stack to do these calls. Should I change my approach? If so; how should I do it ?

thumbnail21:01:01

Removing the direct calls to the cookies-middleware in the sessions-middleware results in the intented behaviour; Which is both the session and the 'other' cookies being encoded and decoded using the setup encoder and decoder.

weavejester16:01:26

Can you open an issue for this? It looks like an interaction that wasn’t considered.

1
thumbnail09:01:40

Sorry for the delay, but the issue has been filed 🙂 https://github.com/ring-clojure/ring/issues/456 including a repro