Our apache error log is littered with messages saying client denied by server configuration, even though the htaccess configuration is working as intended.
Here is the relevant bit of the htaccess:
SetEnvIfExpr "req_novary('User-Agent') =~ /.*WHATEVER.*/" WHATEVER=1
<RequireAll>
# Only allow access for these hosts
Require expr "%{HTTP_HOST} =~ /((host1|host2|host3)\.com)/"
# Deny access if any of the rules in the RequireNone succeed!
<RequireNone>
# IIRC putting the two requires here is fine, it's an implicit OR.
Require expr "%{REQUEST_URI} =~ m#.*RELEASE_NOTES\.txt#i"
<RequireAll>
# Block path unless it's one of the User Agents we want to allow
Require expr "%{REQUEST_URI} =~ m#pathy/path#i"
# This expr is what seems to trigger the error, even though the User Agent
# matches and the server responds with a HTTP 200 code (and the request is successful).
Require expr "!(reqenv('WHATEVER') == 1)"
</RequireAll>
</RequireNone>
</RequireAll>
If we test it using the correct user agent it works fine, we get an HTTP 200 and the response is valid. If we use a different UA it will give us a 403 Forbidden as expected. But on every successful request the error client denied by server configuration will be logged.
We had this same issue with a different Require expr statement, but we changed that one to a rewrite rule to resolve it (this previous issue was resulting in a log message for basically every resource access). We can do the same again here, but I'm curious why this may be resulting in the error.