2019独角兽企业重金招聘Python工程师标准>>>
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