'~^Mozilla\/5\.0\ QGIS\/' 'QGIS';
}
+map $http_user_agent $denied_scraper {
+ default ''; # Not denied
+ '~^Python\-urllib\/' 'Python';
+ '~^R$' 'R';
+ '~^Java\/' 'Java';
+ '~^tiles$' 'Unknown';
+}
+
+map $http_referer $denied_referer {
+ default ''; # Not denied
+ 'http://www.openstreetmap.org/' 'old-osm';
+ 'http://www.osm.org/' 'old-osm';
+ 'http://openstreetmap.org' 'fake-osm';
+ 'http://www.openstreetmap.org' 'fake-osm';
+}
+
# Limit Cache-Control header to only approved User-Agents
map $http_user_agent $limit_http_cache_control {
default ''; # Unset Header
set $limit_rate 65536;
}
+ if ($denied_scraper) {
+ return 429;
+ }
+ if ($denied_referer) {
+ return 418;
+ }
+
# Strip any ?query parameters from urls
set $args '';