X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/8ebc673ebf9ed3ceb2f278d2c0e42b836a34a37c..932d945b7f897fd18be7d4c2fac3eda3915aa296:/website/reverse.php?ds=sidebyside diff --git a/website/reverse.php b/website/reverse.php index c155fa57..810be3c4 100755 --- a/website/reverse.php +++ b/website/reverse.php @@ -2,6 +2,22 @@ require_once(dirname(dirname(__FILE__)).'/lib/init-website.php'); require_once(CONST_BasePath.'/lib/log.php'); + if (preg_match(CONST_BlockedUserAgents, $_SERVER["HTTP_USER_AGENT"]) > 0) + { + $fLoadAvg = getLoadAverage(); + if ($fLoadAvg >= CONST_BlockReverseMaxLoad) { + header('HTTP/1.0 403 Forbidden'); + header('Content-type: text/html; charset=utf-8'); + echo "

App temporarily blocked

"; + echo "Your application has been temporarily blocked from the OpenStreetMap Nominatim "; + echo "geolocation service due to high server load."; + echo "\n\n"; + exit; + } + + } + + if (strpos(CONST_BulkUserIPs, ','.$_SERVER["REMOTE_ADDR"].',') !== false) { $fLoadAvg = getLoadAverage();