您的位置:首页 > 其它

同域名下不同端口 cookie共享冲突问题

2015-01-27 00:00 447 查看
play framework的session是基于cookie的

默认是存放在PLAY_SESSION这个cookie中

而当同一个IP或者域名的不同端口上都部署了play项目,这时候就会引发不可知的session冲突

参考一下配置

application.session.cookie=xxx 这样 session默认存放的cookie name就是 xxx_SESSION了,给不同的项目定义不同的名字就能避免session冲突了

# Session configuration
# ~~~~~~~~~~~~~~~~~~~~~~

# By default, session will be written to the transient PLAY_SESSION cookie.

# The cookies are not secured by default, only set it to true

# if you're serving your pages through https.

application.session.cookie=xxx

# application.session.maxAge=1h

# application.session.secure=false

# Session/Cookie sharing between subdomain

# ~~~~~~~~~~~~~~~~~~~~~~

# By default a cookie is only valid for a specific domain. By setting

# application.defaultCookieDomain to '.example.com', the cookies

# will be valid for all domains ending with '.example.com', ie:

# foo.example.com and bar.example.com

# application.defaultCookieDomain=.example.com
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: