Apache ProxyPass 和会话
因此,我使用 Apache 将特定文件夹代理到 Glassfish 实例。我的会议中的规则是:
ProxyPass /folder http://localhost:28083
ProxyPassReverse /folder http://localhost:28083
ProxyPassReverseCookiePath /folder http://localhost:28083
除了会话之外,它工作正常。对于每个子文件夹,都会创建一个新会话。
因此,当我停留在一个文件夹中时,会话仍然存在,但是一旦我跳到另一个文件夹中,就会创建一个新会话。
如何为所有子文件夹建立一个会话?
So I'm using Apache to proxy a specific folder to a Glassfish instance. The rules in my conf are:
ProxyPass /folder http://localhost:28083
ProxyPassReverse /folder http://localhost:28083
ProxyPassReverseCookiePath /folder http://localhost:28083
It's working fine, except for the sessions. For every subfolder a new session is created.
So while I stay in one folder, the session persists, but as soon as I jump into another folder a new session is made.
How can I have one session for all subfolders?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
正如 covener 已经提到的,ProxyPassReverseCookiePath 的第二个参数应该是路径。请注意,与其他指令相比,参数会进行切换,因此在您的情况下,它将是:(
从技术上讲,这对于它的工作来说不是必需的,因为来自路径
/
的 cookie 也可用在/folder/
中,但这可能会导致它们干扰您在同一域上运行的其他 Web 应用程序的 cookie。)此外,您可能还想转换 cookie 域(除非您仅通过以下方式访问您的应用程序
http://localhost/folder/
):example.com
是访问您的 Web 应用程序的域。As covener already mentioned, the second parameter of
ProxyPassReverseCookiePath
should be a path. Be aware that the parameters are switched compared to the other directives, so in your case it would be:(Technically, this should not be necessary for it to work, as cookies from the path
/
are also available in/folder/
, but it might cause them to interfere with the cookies of other web applications that you are running on the same domain.)In addition, you might want to transform the cookie domain as well (unless you access your application only through
http://localhost/folder/
):example.com
is the domain over which your web application is accessed.ProxyPassReverseCookiePath 的第二个参数应该只是一个路径,而不是完整的 URL。 Apache 无法正确修复当前无效使用情况下烘焙到 cookie 中的路径。
ProxyPassReverseCookiePath's 2nd parameter should just be a path, not a full URL. Apache can't properly fixup the path baked into the cookie w/ the current invalid usage.