I need a rule to block all POST requests to wp-login.php,
But I need to check if the referer domain is equal to requested domain name
We need to check such things:
- check for requested domain value (example: sitename1.com)
- check for referer domain value (example: sitename1.com)
- if requested domain is equal to referer domain
- if request is POST
- if requested file is wp-login.php
I have the following code to check the referer but I need to check the domain in referer too
#Block WP logins with no referring URL
<Locationmatch "/wp-login.php">
SecRule REQUEST_METHOD "POST" "deny,status:401,id:5000130,chain,msg:'wp-login request blocked, no referer'"
SecRule &HTTP_REFERER "@eq 0"
</Locationmatch>
in this case I can check the visitor completely and ensure he is a human appreciate for any help
I'm not sure I understand your question, but may be this chained rule will help you:
Please keep it mind:
Referer
header is setHost
header must also existsMay be you need an another chained rule, which checks the existence of
Referer
header, if the URI is/wp-login
, but I think based on the rule above you can produce it.