Answer the question
In order to leave comments, you need to log in
Is it possible to use regular expressions to check $http_referer?
A small flood is pouring onto the server, in the referee all sorts of crap like "5asdasd3fdas3.net", "4asdfas334.name" and so on. Is it possible to make a regular expression for this case? That is,
If ($http_referer contains more than one digit) {
return 444;
}
Answer the question
In order to leave comments, you need to log in
Regular can be used for any variable in if. If you need the regular expression itself for the “contains more than one digit” condition, then it looks something like this:
if ($http_referer ~ \d.*\d) {
return 444;
}
It's better to save the IP where strange requests come from and ban them.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question