X-Git-Url: https://git.openstreetmap.org./nominatim.git/blobdiff_plain/a049e8a7c6745513487e5811caf2ae3dd92d3a37..25db5f271addc4ff5aa2d3b32f1582c48dca3405:/lib/init-website.php?ds=inline diff --git a/lib/init-website.php b/lib/init-website.php index 6db2ac37..013aee4b 100644 --- a/lib/init-website.php +++ b/lib/init-website.php @@ -1,34 +1,16 @@

Access blocked

"; - echo "Your IP has been blocked for overusing OpenStreetMap's volunteer-run servers.
\n"; - echo 'Please consult the Nominatim usage policy for more information.'; - echo "\n\n"; - exit; - } + if (CONST_NoAccessControl) + { + header("Access-Control-Allow-Origin: *"); + header("Access-Control-Allow-Methods: OPTIONS,GET"); + header("Access-Control-Max-Age: 8640000"); + if (!empty($_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS'])) + { + header("Access-Control-Allow-Headers: ".$_SERVER['HTTP_ACCESS_CONTROL_REQUEST_HEADERS']); + } + } + if ($_SERVER['REQUEST_METHOD'] == 'OPTIONS') exit; - $sTempBlockedIP = file_get_contents(CONST_IPBanFile); - if (preg_match('/\b'.$_SERVER["REMOTE_ADDR"].'\b/', $sTempBlockedIP)) - { - header('HTTP/1.0 503 Service Temporarily Unavailable'); - header('Content-type: text/html; charset=utf-8'); - echo "

Access blocked

"; - echo "Your IP has been blocked temporarily for overusing OpenStreetMap's volunteer-run servers. This ban will be lifted automatically in a while. To avoid further blocks, please read the
\n"; - echo 'Nominatim usage policy carefully before you continue to use this service.'; - echo "\n\n"; - exit; - } - - } + header('Content-type: text/html; charset=utf-8');