add domain to session option
Reported by hampsterx | September 18th, 2008 @ 10:52 AM
(first post be gentle)
Inside init.rb I want to be able to use
Merb::Config.use do |c|
... c[:session_domain] = ".localhost.com"
end
This allows you to write applications on subdomains that piggy back the domain session. php equivalent is..
ini_set("session.cookie_domain", '.localhost.com');
I modified session.rb with the following
base._session_domain = Merb::Config[:session_domain]
cookies.set_cookie(session_id_key, value, { :expires => Time.now + session_expiry, :domain => _session_domain }.merge(options))
works fine..
Comments and changes to this ticket
-
Michael Klishin (antares) September 18th, 2008 @ 01:49 PM
- → Tag changed from to merb-core sessions
- → State changed from new to open
Feel free to submit patches (use git-format-patch). Make sure you add spec examples for your changes.
-
Yehuda Katz (wycats) September 19th, 2008 @ 11:33 AM
- → Assigned user changed from to Fabien Franzen (loob2)
-
Goh Toh Chye September 19th, 2008 @ 06:22 PM
The cookie domain is set using
Merb::Config.use do |c| ... c[:default_cookie_domain] = '..' end -

Fabien Franzen (loob2) September 19th, 2008 @ 06:27 PM
- → State changed from open to resolved
Thank you Goh Toh Chye - that's indeed the correct config option; it's for all cookies, not just the session cookie, therefore it's :default_cookie_domain.
Please Login or create a free account to add a new comment.
You can update this ticket by sending an email to from your email client. (help)
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
