# Multi-Site sessions

**URL:** <https://www.ruby-forum.com/t/multi-site-sessions/163507>\
**Category:** Rails\
**Created:** [March 21, 2009, 3:44am UTC](https://www.ruby-forum.com/t/multi-site-sessions/163507 "2009-03-21T03:44:24Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![petrjanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee7513/32.png) [@petrjanda](https://www.ruby-forum.com/u/petrjanda)\
**Post date:** [March 21, 2009, 3:44am UTC](https://www.ruby-forum.com/t/multi-site-sessions/163507/1 "2009-03-21T03:44:24Z")

</div>

Hi all,  
Im developing an application that runs on multiple physical boxes (and  
thus different hostnames). Both of the boxes will run the same  
application (connecting to a shared postgres server). What I need is  
when someone logs in on box 1 (ie. [box1.domain.com](http://box1.domain.com)), and then traverses  
via a link to box 2 (ie. [box2.domain.com](http://box2.domain.com)), he or she will not have to  
login again.

How can I do this?

Thanks  
Petr

---

<div class="post-metadata">

**Author:** ![petrjanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee7513/32.png) [@petrjanda](https://www.ruby-forum.com/u/petrjanda)\
**Post date:** [March 21, 2009, 3:54am UTC](https://www.ruby-forum.com/t/multi-site-sessions/163507/2 "2009-03-21T03:54:30Z")

</div>

On Mar 21, 2:44 am, Petr J. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Hi all,  
> Im developing an application that runs on multiple physical boxes (and  
> thus different hostnames). Both of the boxes will run the same  
> application (connecting to a shared postgres server). What I need is  
> when someone logs in on box 1 (ie. [box1.domain.com](http://box1.domain.com)), and then traverses  
> via a link to box 2 (ie. [box2.domain.com](http://box2.domain.com)), he or she will not have to  
> login again.

That’s what the :session\_domain key for the session options is for.  
Maybe there’s more to your setup that you haven’t described but if it  
is exactly the same code running on the various boxes and you just  
happen to have multiple ones because 1 couldn’t service your load then  
you don’t need this at all. You can stick a load balancer in front,  
users always go to [www.domain.com](http://www.domain.com) and the load balancer spreads the  
requests out to your various machines (the load balancer can be  
anything from specialised hardware to software like haproxy, nginx or  
apache).

Fred

---

<div class="post-metadata">

**Author:** ![petrjanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee7513/32.png) [@petrjanda](https://www.ruby-forum.com/u/petrjanda)\
**Post date:** [March 21, 2009, 7:28am UTC](https://www.ruby-forum.com/t/multi-site-sessions/163507/3 "2009-03-21T07:28:13Z")

</div>

No its not because one box cannot handle the load, but because certain  
activities the users would be doing are best done on a separate  
high-performance box(other than the normal web-server).

---

<div class="post-metadata">

**Author:** ![petrjanda](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/ee7513/32.png) [@petrjanda](https://www.ruby-forum.com/u/petrjanda)\
**Post date:** [March 21, 2009, 7:42am UTC](https://www.ruby-forum.com/t/multi-site-sessions/163507/4 "2009-03-21T07:42:53Z")

</div>

Anyway, session\_domain works as expected. Thanks!

Petr
