# Session\_id generation different for subdomains

**URL:** <https://discuss.rubyonrails.org/t/session-id-generation-different-for-subdomains/8612>\
**Category:** rubyonrails-talk\
**Created:** [February 12, 2007, 8:27pm UTC](https://discuss.rubyonrails.org/t/session-id-generation-different-for-subdomains/8612 "2007-02-12T20:27:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![bramski](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@bramski](https://discuss.rubyonrails.org/u/bramski)\
**Post date:** [February 12, 2007, 8:27pm UTC](https://discuss.rubyonrails.org/t/session-id-generation-different-for-subdomains/8612/1 "2007-02-12T20:27:00Z")

</div>

Hi! So, I've got a bunch of different subdomains for our site...

foobar.myhost.com bar.myhost.com foo.myhost.com

However, I would like for RAILS to have consistent session ids for each of these subdomains as they all point at the same rails appliation (i change behavior by adding some request headers at the apache end which handles directing them to the right rails application).

Does anybody know if there's a patch needed, or a configuration to do to make rails not pay attention to the prefix of the domain name requested?

---

<div class="post-metadata">

**Author:** ![bramski](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@bramski](https://discuss.rubyonrails.org/u/bramski)\
**Post date:** [February 12, 2007, 10:20pm UTC](https://discuss.rubyonrails.org/t/session-id-generation-different-for-subdomains/8612/2 "2007-02-12T22:20:30Z")

</div>

Excellent point...

However, I'm in control of the redirection to the new site, so I could just reproduce the cookie on the redirect. Or could I set a cookie which is good for all \*.myhost.com?

---

<div class="post-metadata">

**Author:** ![bramski](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@bramski](https://discuss.rubyonrails.org/u/bramski)\
**Post date:** [February 12, 2007, 10:51pm UTC](https://discuss.rubyonrails.org/t/session-id-generation-different-for-subdomains/8612/3 "2007-02-12T22:51:50Z")

</div>

Yes, some quick digging, and you CAN set a cookie which acts over all subdomains.

[https://trac.cakephp.org/ticket/830](https://trac.cakephp.org/ticket/830)

Looks like this was done in cakephp.... was it done in Rails?

---

<div class="post-metadata">

**Author:** ![bramski](https://avatars.discourse-cdn.com/v4/letter/b/c2a13f/32.png) [@bramski](https://discuss.rubyonrails.org/u/bramski)\
**Post date:** [February 12, 2007, 11:29pm UTC](https://discuss.rubyonrails.org/t/session-id-generation-different-for-subdomains/8612/4 "2007-02-12T23:29:38Z")

</div>

I guess I'll answer my own question. But for anybody who's wondering. [http://threebit.net/mail-archive/rails/msg00708.html](http://threebit.net/mail-archive/rails/msg00708.html)
