Tomcat cookie 无法通过我的 ProxyPass VirtualHost 工作

2024-02-29

当使用 ProxyPass 将端口 80 上的流量重定向到通过 Tomcat 托管的 Web 应用程序时,我在获取 cookie 时遇到一些问题。

我启用 cookie 的动机是摆脱附加到 URL 的“jsessionid=”参数。

我已在 META-INF/ 中的 context.xml 中为我的 Web 应用程序启用了 cookie。
当我通过访问网络应用程序时http://url:8080/webapp http://url:8080/webapp它按预期工作,jsessionid 参数在 URL 中不可见,而是存储在 cookie 中。

当通过 apache2 虚拟主机访问我的网站时,cookie 似乎不起作用,因为现在“jsessionid”被附加到 URL 中。我该如何解决这个问题?

这是我的 VHost 配置:



<VirtualHost *:80>
        ServerName somedomain.no
        ServerAlias www.somedomain.no

        <Proxy *>
                Order deny,allow
                Allow from all
        </Proxy>

        ProxyPreserveHost Off
        ProxyPass / http://localhost:8080/webapp/
        ProxyPassReverse / http://localhost:8080/webapp/

        ErrorLog /var/log/apache2/somedomain.no.error.log
        CustomLog /var/log/apache2/somedomain.no.access.log combined
</VirtualHost>
  

编辑:实际上正在设置cookie。我猜测问题在于 cookie 包含“Path: /webapp”。


我想到了。

将其添加到 VHost 配置中:



ProxyPassReverseCookiePath /webapp /
  
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Tomcat cookie 无法通过我的 ProxyPass VirtualHost 工作 的相关文章

随机推荐