简体   繁体   中英

Reading top level domain cookie from subdomain, how to?

My vbulletin forum sets up some cookies on top level domain domain-name.com I have rails app on beta.domain-name.com . Is it possible to read these top level cookies within my app? How can I do this?

Yes , It is possible.

You need to specify domain attribute as :domain => .domain-name.com

For example:

cookies[:your_cookie] = {:value => 'something', :domain => '.domain-name.com'}

Now, cookies can be accessed in *.domain-name.com and domain-name.com .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM