# Big help with shared subdomains cookies

**URL:** <https://www.ruby-forum.com/t/big-help-with-shared-subdomains-cookies/171446>\
**Category:** Rails\
**Created:** [July 2, 2009, 4:55pm UTC](https://www.ruby-forum.com/t/big-help-with-shared-subdomains-cookies/171446 "2009-07-02T16:55:52Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![xdmx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/53a042/32.png) [@xdmx](https://www.ruby-forum.com/u/xdmx)\
**Post date:** [July 2, 2009, 4:55pm UTC](https://www.ruby-forum.com/t/big-help-with-shared-subdomains-cookies/171446/1 "2009-07-02T16:55:52Z")

</div>

Hi, i need that all the subdomains of an app (using subdomain\_fu) use  
‘.domain.com’ as domain for all cookies.  
I’ve set ActionController::Base.session\_options[:domain] = ‘.domain.com’  
and it works…for just the session… how can i set this also for  
common cookies ? (created with cookies[:name] = {:value =\> value,  
:expires =\> 6.months.from\_now} )

---

<div class="post-metadata">

**Author:** ![xdmx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/53a042/32.png) [@xdmx](https://www.ruby-forum.com/u/xdmx)\
**Post date:** [July 2, 2009, 5:00pm UTC](https://www.ruby-forum.com/t/big-help-with-shared-subdomains-cookies/171446/2 "2009-07-02T17:00:08Z")

</div>

“I’ll read the doc before asking”\*100000

Found, it’s just a simple :domain =\> at the creation of the cookie

Sorry for the noise

---

<div class="post-metadata">

**Author:** ![xdmx](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/x/53a042/32.png) [@xdmx](https://www.ruby-forum.com/u/xdmx)\
**Post date:** [July 2, 2009, 5:10pm UTC](https://www.ruby-forum.com/t/big-help-with-shared-subdomains-cookies/171446/3 "2009-07-02T17:10:15Z")

</div>

On Thu, Jul 2, 2009 at 7:55 AM, Xdmx  
Xdmx[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Hi, i need that all the subdomains of an app (using subdomain\_fu) use  
> ‘.domain.com’ as domain for all cookies.  
> I’ve set ActionController::Base.session\_options[:domain] = ‘.domain.com’  
> and it works…for just the session… how can i set this also for  
> common cookies ? (created with cookies[:name] = {:value =\> value,  
> :expires =\> 6.months.from\_now} )

Read the Rails API doc?

–  
Hassan S. ------------------------ removed\_email\_address@domain.invalid
