Add support for referer blocks in tile server export script
authorTom Hughes <tom@compton.nu>
Tue, 29 Nov 2016 16:55:09 +0000 (16:55 +0000)
committerTom Hughes <tom@compton.nu>
Tue, 29 Nov 2016 16:55:27 +0000 (16:55 +0000)
cookbooks/tile/templates/default/export.erb

index dfd076252167166384bc5c1397ba3b08200b18c3..b9f389626699c91c7947c96b0427e17d6c8ccb5c 100644 (file)
@@ -71,6 +71,11 @@ elif os.environ['HTTP_USER_AGENT'] == '<%= user_agent %>':
   # Block scraper
   output_error("The server is too busy at the moment. Please wait a few minutes before trying again.", "503 Service Unavailable")
 <% end -%>
+<% @blocks["referers"].each do |referer| -%>
+elif os.environ['HTTP_REFERER'] == '<%= referer %>':
+  # Block scraper
+  output_error("The server is too busy at the moment. Please wait a few minutes before trying again.", "503 Service Unavailable")
+<% end -%>
 elif not form.has_key("bbox"):
   # No bounding box specified
   output_error("No bounding box specified")