摘要式身份验证拒绝接受有效凭据

发布于 2024-08-07 16:24:49 字数 396 浏览 4 评论 0原文

我正在尝试通过 .htaccess 文件使用摘要式身份验证来保护文件夹:

AuthType Digest
AuthName "Restricted Area"
AuthUserFile /web/htdocs/www.domain.com/.../.htdigest

Require valid-user

我已使用命令“htdigest”创建了密码文件。 在我的本地服务器上一切正常......但在我的远程服务器(托管网站)上却不行! 即使我输入正确的密码,浏览器也会显示登录面板!

在远程服务器上,PHP 作为 CGI 运行,而不是作为 Apache 的模块运行...应该是这个原因吗?有一些解决方法吗?

使用 .htaccess 的基本身份验证在同一远程服务器上运行良好!

I'm trying to protect a folder with Digest Authentication through a .htaccess file:

AuthType Digest
AuthName "Restricted Area"
AuthUserFile /web/htdocs/www.domain.com/.../.htdigest

Require valid-user

I've created the file of passwords with the comand "htdigest".
All works fine on my local server ... but not on my remote server (hosted website)!
The browser shows the login panel even if I enter a correct password!

On the remote server PHP is running as CGI not as a module of Apache ... should be this the cause? Is there some workaround?

A Basic Authentication with .htaccess works fine on the same remote server!

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

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

发布评论

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

评论(2

揽清风入怀 2024-08-14 16:24:49

如果脚本作为 CGI 运行,则意味着它作为本地用户运行,而不是作为 www 运行,这可能是问题所在,是的。 CGI 是唯一的选择吗?

If the script is running as CGI, that means it is running as the local user, not as www, which is probably the problem, yes. Is CGI the only option?

泪之魂 2024-08-14 16:24:49

上面的代码缺少 AuthDigestDomain 指令,关于该文档 说:

该指令应该始终是
指定并至少包含
该空间的(一组)根 URI。
忽略这样做会导致
客户端发送授权
发送到此的每个请求的标头
服务器。除了加大尺寸之外
的请求,它也可能有一个
对性能产生不利影响,如果
AuthDigestNcCheck 已开启。

不过,我确实通过启用 Apache 模块 mod_auth_digest 而不是模块 mod_digest 解决了这个问题。

The code above is missing the AuthDigestDomain directive, about that the documentation says:

This directive should always be
specified and contain at least the
(set of) root URI(s) for this space.
Omitting to do so will cause the
client to send the Authorization
header for every request sent to this
server. Apart from increasing the size
of the request, it may also have a
detrimental effect on performance if
AuthDigestNcCheck is on.

However, I've definitely solved the problem by enabling the Apache module mod_auth_digest instead of the module mod_digest.

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