<commit_before># DO NOT EDIT - This file is being maintained by Chef

upstream tile_cache_backend {
  server 127.0.0.1;

  # Add the other caches to relieve pressure if local squid failing
  # Balancer: round-robin
<% @caches.each do |cache| -%>
<% if cache[:hostname] != node[:hostname] -%>
<% if node[:tilecache][:tile_siblings].include? cache[:fqdn] -%>
<% cache.ipaddresses(:family => :inet, :role => :external).sort.each do |address| -%>
  server <%= address %> backup; # Server <%= cache[:hostname] %>
<% end -%>
<% end -%>
<% end -%>
<% end -%>

  keepalive 256;
}

# Geo Map of tile caches
geo $tile_cache {
  default 0;
<% @caches.each do |cache| -%>
<% cache.ipaddresses(:family => :inet, :role => :external).sort.each do |address| -%>
  <%= address %> 1; # <%= cache[:hostname] %>
<% end -%>
<% end -%>
}

# Rates table based on current cookie value
map $cookie_qos_token $limit_rate_qos {
  include /etc/nginx/conf.d/tile_qos_rates.map;
}

# Set-Cookie table based on current cookie value
map $cookie_qos_token $cookie_qos_token_set {
  include /etc/nginx/conf.d/tile_qos_cookies.map;
}

map $http_user_agent $approved_scraper {
  default                   0; # Not approved
  '~^JOSM\/'                1; # JOSM
  '~^Mozilla\/5\.0\ QGIS\/' 1; # QGIS
}

map $http_user_agent $denied_scraper {
  default                0; # Not denied
  '~^Python\-urllib\/'   1; # Library Default
  '~^python\-requests\/' 1; # Library Default
  '~^node\-fetch\/'      1; # Library Default
  '~^R$'                 1; # Library Default
  '~^Java\/'             1; # Library Default
  '~^tiles$'             1; # Library Default
  '~^Dalvik\/'           1; # Library Default
  '~^runtastic'          1; # App
  'Mozilla/4.0'          1; # Fake
  'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)' 1;  # Fake
}

map $http_referer $denied_referer {
  default                          0; # Not denied
  'http://www.openstreetmap.org/'  1; # Faked
  'http://www.openstreetmap.org'   1; # Faked
  'http://openstreetmap.org/'      1; # Faked<commit_msg>tilecache: reject request without user-agent (try2)<commit_after># DO NOT EDIT - This file is being maintained by Chef

upstream tile_cache_backend {
  server 127.0.0.1;

  # Add the other caches to relieve pressure if local squid failing
  # Balancer: round-robin
<% @caches.each do |cache| -%>
<% if cache[:hostname] != node[:hostname] -%>
<% if node[:tilecache][:tile_siblings].include? cache[:fqdn] -%>
<% cache.ipaddresses(:family => :inet, :role => :external).sort.each do |address| -%>
  server <%= address %> backup; # Server <%= cache[:hostname] %>
<% end -%>
<% end -%>
<% end -%>
<% end -%>

  keepalive 256;
}

# Geo Map of tile caches
geo $tile_cache {
  default 0;
<% @caches.each do |cache| -%>
<% cache.ipaddresses(:family => :inet, :role => :external).sort.each do |address| -%>
  <%= address %> 1; # <%= cache[:hostname] %>
<% end -%>
<% end -%>
}

# Rates table based on current cookie value
map $cookie_qos_token $limit_rate_qos {
  include /etc/nginx/conf.d/tile_qos_rates.map;
}

# Set-Cookie table based on current cookie value
map $cookie_qos_token $cookie_qos_token_set {
  include /etc/nginx/conf.d/tile_qos_cookies.map;
}

map $http_user_agent $approved_scraper {
  default                   0; # Not approved
  '~^JOSM\/'                1; # JOSM
  '~^Mozilla\/5\.0\ QGIS\/' 1; # QGIS
}

map $http_user_agent $denied_scraper {
  default                0; # Not denied
  ''                     1; # No User-Agent Set
  '~^Python\-urllib\/'   1; # Library Default
  '~^python\-requests\/' 1; # Library Default
  '~^node\-fetch\/'      1; # Library Default
  '~^R$'                 1; # Library Default
  '~^Java\/'             1; # Library Default
  '~^tiles$'             1; # Library Default
  '~^Dalvik\/'           1; # Library Default
  '~^runtastic'          1; # App
  'Mozilla/4.0'          1; # Fake
  'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)' 1;  # Fake
}

map $http_referer $denied_referer {
  default                          0; # Not denied
  'http://www.openstreetmap.org/'  1; # Faked
  'http://www.openstreetmap.org'   1; # Faked
  'http://openstreetmap.org/'      1; # Faked
{'fraction_non_alphanumeric': 0.16770334928229666, 'fraction_numerical': 0.019617224880382776, 'mean_word_length': 2.616782006920415, 'pattern_counts': {'":': 0, '<': 35, '<?xml version=': 0, '>': 43, 'https://': 0, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '674607', 'n_tokens_mistral': 1628, 'n_tokens_neox': 1511, 'n_words': 372}