浙江省高等学校教师教育理论培训

微信搜索“教师资格证岗前培训”小程序

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4818-share-session-between-subdomains#ticket-4818-3


Share session between subdomains

Reported by Guillermo Álvarez | June 10th, 2010 @ 10:58 AM

Sessions cookies don't hace domain, so by default navigators use current HTTP_HOSTS.

If you want to share session between www.example.com and username.example.com you can't.

The next patch resolve this problem by adding a domain option in session_store initializar.

The syntax is:

<code class="ruby">  Rails.application.config.session_store <span class="symbol">:cookie_store</span>, <span class="symbol">:key</span> => <span class="string">'_app_session'</span>, <span class="symbol">:domain</span> => <span class="symbol">:all</span></code> 

Comments and changes to this ticket


永久性cookie
http://www.thoughtrails.com/episodes/36-signed-and-permanent-cookies-in-rails3

posted on 2010-12-29 10:47  lexus  阅读(468)  评论(0编辑  收藏  举报