# Subdomain query

**URL:** <https://www.ruby-forum.com/t/subdomain-query/128688>\
**Category:** Rails\
**Created:** [February 10, 2008, 5:26pm UTC](https://www.ruby-forum.com/t/subdomain-query/128688 "2008-02-10T17:26:43Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 10, 2008, 5:26pm UTC](https://www.ruby-forum.com/t/subdomain-query/128688/1 "2008-02-10T17:26:43Z")

</div>

When working with my app with subdomain support (with plugin  
account\_location), I have following issue: From the main domain, user  
can register (with information about subdomain). After successful  
register, the app will log user in and forward to corresponding  
subdomain. The problem here is that after redirecting, all session  
data get lost (i think because the subdomain is considered another  
website from the main domain), so I can’t retain info about newly  
created data.  
Is there any solution to this problem? I think that if I use db for  
session store, I can get session data from db, but I want a generic  
solution.

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 10, 2008, 6:24pm UTC](https://www.ruby-forum.com/t/subdomain-query/128688/2 "2008-02-10T18:24:23Z")

</div>

I’m not sure about RoR, but I expect the following applies… certainly  
when  
using PHP or JSP there is a scope higher than session scope and that is  
application scope - application scope variables are accessible by any  
website regardless of sessions as long as the browser remains open.

* * *

Gareth Howells, CertHE (Dunelm), BCS  
CEO, GForce Industries

garethATgforce-industriesDOTcoDOTuk  
07862725134

GForce Industries  
86, Warwick Avenue,  
Quorn,  
Loughborough,  
LEICS.  
LE12 8HE  
----- Original Message -----  
From: “removed\_email\_address@domain.invalid” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
To: “Ruby on Rails: Talk” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
Sent: Sunday, February 10, 2008 4:24 PM  
Subject: [Rails] subdomain query

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 26, 2008, 10:29am UTC](https://www.ruby-forum.com/t/subdomain-query/128688/3 "2008-02-26T10:29:50Z")

</div>

hi can anyone tell me this thing

On Feb 10, 9:51 pm, “Gareth Howells” \<subscripti…@gforce-

---

<div class="post-metadata">

**Author:** ![casper\_the\_ghost](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/58956e/32.png) [@casper\_the\_ghost](https://www.ruby-forum.com/u/casper_the_ghost)\
**Post date:** [February 26, 2008, 12:10pm UTC](https://www.ruby-forum.com/t/subdomain-query/128688/4 "2008-02-26T12:10:10Z")

</div>

On 26 Feb 2008, at 09:29, removed\_email\_address@domain.invalid wrote:

> hi can anyone tell me this thing

You need to ensure that the session cookie is set to for [foo.com](http://foo.com), not  
[xyz.foo.com](http://xyz.foo.com)  
You can probably change this with  
ActionController::CgiRequest::DEFAULT\_SESSION\_OPTIONS, but i don’t  
have the details to hand.

Fred
