agrafix / Spock

Another Haskell web framework for rapid development
https://www.spock.li
679 stars 56 forks source link

cookie domain for spocksession cookie #145

Closed gurgl closed 2 years ago

gurgl commented 6 years ago

Hi

I have a little website that uses 2 domains: example.com and subdomain.example.com. I've gathered I could add "domain" to the cookie header, in HTTP terms, to make both domains use the same cookie. Looking at the code of Spock it looks hard to change defaultCookieConfig, where this property is read. That is what the SessionManager uses for generating the default spocksession cookie it appears. Do you see a simple way of changing the cookie domain for all requests?

And please tell if this idea is bad, to begin with? Should one leave the spocksession alone or something? It looks as if it is what is used for the Spock (non Spock-Core) resource config.

agrafix commented 6 years ago

Hey! It feels reasonable to extend SessionCfg ( http://hackage.haskell.org/package/Spock-0.12.0.0/docs/Web-Spock-Config.html#t:SessionCfg ) for this purpose. Are you up for a PR for this? :)