使用 mod_jk 进行 Apache 基本身份验证 (basic-auth) 后,请求中没有主体

发布于 2024-08-04 04:59:25 字数 311 浏览 4 评论 0原文

环境

Apache 2.2.13 使用 mod_jk (ajp13) 连接到 Tomcat 5.5。 Apache 需要对“/”进行基本身份验证,即对其服务的所有 URL 进行基本身份验证。

问题

一旦请求到达 Tomcat 中的我的应用程序(它是一个 Servlet 过滤器),request.getUserPrincipal() 返回 null。然而,Apache 确实验证了该请求。我确实在浏览器的对话框中输入了用户/密码。

有什么想法吗?

Environment

Apache 2.2.13 connect to Tomcat 5.5 with mod_jk (ajp13). Apache requires basic-auth for "/" i.e. for all URLs it serves.

Problem

Once the request arrives at my app in Tomcat (it's a Servlet filter) request.getUserPrincipal() returns null. Apache, however, did authenticate the request. I did enter user/password in the browser's dialog.

Any ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

静赏你的温柔 2024-08-11 04:59:25

几个小时后我终于找到了罪魁祸首。与往常一样,一个标志就可以发挥全部作用。

server.xml 中,必须使用 tomcatAuthentication="false" 配置 AJP/1.3 连接器。可以在此处找到此参数的说明(滚动到底部): < /a>http://tomcat.apache.org/tomcat-5.5 -doc/config/ajp.html

以下线程有很大帮​​助: mail-archive.com/[电子邮件受保护]/msg55080.html

After hours I finally found the culprit. As so often, a single flag makes all the difference.

In server.xml the AJP/1.3 connector must be configured with tomcatAuthentication="false". An explanation of this parameter can be found here (scroll to bottom): http://tomcat.apache.org/tomcat-5.5-doc/config/ajp.html.

The following threads helped quite a bit: mail-archive.com/[email protected]/msg55080.html.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文