]> git.openstreetmap.org Git - chef.git/blobdiff - cookbooks/tilecache/templates/default/nginx_tile.conf.erb
tilecache: allow nginx to fallback to other caches
[chef.git] / cookbooks / tilecache / templates / default / nginx_tile.conf.erb
index bc41ffbafde50670ba3dd1caec20109d845da097..76b3f26f5f5a6c9dd01a0b495560d4b231c30d64 100644 (file)
@@ -1,18 +1,15 @@
 # DO NOT EDIT - This file is being maintained by Chef
 
 upstream tile_cache_backend {
-  server 127.0.0.1;
-  server 127.0.0.2;
-  server 127.0.0.3;
+  server 127.0.0.1:80;
+  server 127.0.0.2:80;
 
   # 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 -%>
+  server <%= address %>:80 backup; # Server <%= cache[:hostname] %>
 <% end -%>
 <% end -%>
 <% end -%>
@@ -105,11 +102,6 @@ server {
     # See: http://nginx.org/en/docs/http/ngx_http_ssl_module.html#ssl_early_data
     ssl_early_data on;
 
-    # Only allow GET / HEAD / OPTIONS (CORS) requests
-    limit_except GET HEAD OPTIONS {
-      deny all;
-    }
-
     # Immediately 404 layers we do not support
 <% for i in 20..99 do %>
     location /<%= i %>/ {
@@ -184,6 +176,11 @@ server {
     # Dedicated zoom handler for caching
     location /<%= i %>/ {
 <% end %>
+      # Only allow GET / HEAD / OPTIONS (CORS) requests
+      limit_except GET HEAD OPTIONS {
+        deny all;
+      }
+
       proxy_pass http://tile_cache_backend;
       proxy_set_header X-Forwarded-For $remote_addr;
       proxy_http_version 1.1;