play framework的session是基於cookie的 cookie
默認是存放在PLAY_SESSION這個cookie中 session
而當同一個IP或者域名的不一樣端口上都部署了play項目,這時候就會引起不可知的session衝突 app
參考一下配置 dom
application.session.cookie=xxx 這樣 session默認存放的cookie name就是 xxx_SESSION了,給不一樣的項目定義不一樣的名字就能避免session衝突了
spa
# Session configuration ci
# ~~~~~~~~~~~~~~~~~~~~~~ # 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