如何避免在应用程序的不同实例之间进行不必要的会话转移 [英] How to avoid unwanted session carry-over between different instances of an application

查看:47
本文介绍了如何避免在应用程序的不同实例之间进行不必要的会话转移的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个 Chrome 选项卡(开发环境)中打开了 Zend Framework 应用程序的本地版本.同时,我还打开了在远程服务器上运行的同一应用程序的舞台或实时版本.我登录了其中一个实例.当我尝试登录另一个实例时,此实例退出并出现致命错误,直到我删除了另一个实例的 cookie(我首先登录的实例).

I have the local version of a Zend Framework application open in one Chrome tab (development environment). At the same time I have the stage or live version of the same application running on a remote server open as well. I'm logged in one of the instances. When I try to log in to the other, this instance exits with a fatal error until I delete the cookies of the other instance, where I'm logged in first.

会话 cookie 上的域设置不相同,但仍会发生结转.

The domain setting on the session cookies is not identical but the carry-over still happens.

为什么会这样?
我怎样才能避免它?

Why does that happen?
How can I avoid it?

推荐答案

给每个服务器一个不同的会话名称(不是默认的),这样你就有不同的会话.如果您想在彼此旁边使用多个会话,这通常会起作用(并且您不想检查 cookie 设置,例如小心 cookie 仅在其域中工作,并且在 cookie 旁边没有其他任何东西用于传递 ID).

Give each server a different session name (not the default one), so that you have different sessions. This does normally work if you want to use multiple sessions next to each other (and you don't want to check the cookie settings like taking care cookie works in it's domain only and that next to cookie nothing else is used to pass the ID).

在原生 PHP 中它是 session_name,我假设 Zend Framework 有相应的配置设置

In native PHP it's session_name, I assume Zend Framework has a corresponding configuration setting as well.

这篇关于如何避免在应用程序的不同实例之间进行不必要的会话转移的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆