# Multiple top level domains and one session

**URL:** <https://www.ruby-forum.com/t/multiple-top-level-domains-and-one-session/155923>\
**Category:** Rails\
**Created:** [December 18, 2008, 7:47am UTC](https://www.ruby-forum.com/t/multiple-top-level-domains-and-one-session/155923 "2008-12-18T07:47:30Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![vineire77](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/v/e9c0ed/32.png) [@vineire77](https://www.ruby-forum.com/u/vineire77)\
**Post date:** [December 18, 2008, 7:47am UTC](https://www.ruby-forum.com/t/multiple-top-level-domains-and-one-session/155923/1 "2008-12-18T07:47:30Z")

</div>

Hello all,

I’ve been struggling with this for quite awhile and haven’t been able to  
find a solution. I need a user to be able to view multiple top level  
domains with a single login.

My understanding is that this needs to be set in environment.rb and  
called with before\_dispatch. This is what I’ve come up with:

require ‘activesupport’  
require ‘dispatcher’  
module ActionController  
class Dispatcher

```
  def set_session_domain
    ActionController::Base.session_options.update :session_domain =>

```

“#{@request.host}”  
end

```
  before_dispatch :set_session_domain
end

```

end

* * *

However, this does not seem to be working when I try and pull the values  
from session[:session\_domain].

Any help is greatly appreciated.
