I am trying to restrict specific hosts (e.g. AWS) from accessing my webserver. I tried different variations of these but it doesn't work.
# Block AWS
SecRule REQUEST_HEADERS:Host ".*\.amazonaws\.com.*" \
"msg:'AWS blocked',id:10007,log,t:lowercase,drop,phase:1"
I tried:
SecRule REQUEST_HEADERS:Host ".*\.amazonaws\.com.*"
SecRule REQUEST_HEADERS:Host "@rx ^.*\.amazonaws\.com.*$"
SecRule REQUEST_HEADERS:Host "@contains amazonaws.com"
None of the above works, so I am coming to the conclusion that something is wrong with my header query syntax. Here is the example of the host string I am trying to match for exclusion: Host: ec2-12-34-56-78.compute-1.amazonaws.com