Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/apache/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何正确设置ApacheHTTPD2.4返回错误代码_Apache_Authentication - Fatal编程技术网

如何正确设置ApacheHTTPD2.4返回错误代码

如何正确设置ApacheHTTPD2.4返回错误代码,apache,authentication,Apache,Authentication,在Apache httpd 2.4中,我定义了受保护的位置,如下所示: <Location /mmm> Require all denied AuthName "Protected Contents" AuthType Basic AuthUserFile /www/site-conf/etc/passwd <RequireAny> Require valid-user Require

在Apache httpd 2.4中,我定义了受保护的位置,如下所示:

<Location /mmm>
    Require all denied
    AuthName "Protected Contents"
    AuthType Basic
    AuthUserFile /www/site-conf/etc/passwd

    <RequireAny>
      Require valid-user
      Require env APP-MONITOR
    </RequireAny>
</Location>

要求全部拒绝
AuthName“受保护的内容”
AuthType Basic
AuthUserFile/www/site conf/etc/passwd
需要有效用户
需要env APP-MONITOR
无论是请求者ip在我的白名单中,还是具有正确凭据的请求,都允许访问请求

我的期望: 如果凭证错误,则返回错误代码401,如果其他故障,则返回代码403。 但它总是返回401

如果我注释掉“requirevaliduser”,如果请求者的ip不在我的白名单中,它将返回403

请告知

谢谢