1 # DO NOT EDIT - This file is being maintained by Chef
2 location ~* "^/layer/<%= @layer %>/(\d+)/(\d+)/(\d+)\.(png|jpg|jpeg)$" {
3 # Override QUERY_STRING to force mapserver query parameters
4 fastcgi_param QUERY_STRING "map=/srv/imagery/mapserver/layer-<%= @layer %>.map&mode=tile&layers=<%= @layer %>&tilemode=gmap&tile=$2+$3+$1";
5 fastcgi_pass "<%= @site %>_fastcgi";
6 include fastcgi_params;
7 fastcgi_param REQUEST_METHOD "GET";
8 fastcgi_param HTTP_PROXY "";
9 fastcgi_read_timeout 60s;
12 fastcgi_cache "fastcgi_cache_zone";
13 fastcgi_cache_key "<%= @layer %><%= @revision %> $request_method $1 $2 $3";
15 # Free connection to socket for other requests
16 fastcgi_keep_conn off;
18 fastcgi_cache_valid 200 21d;
20 # Serve stale cache on errors or if updating
21 fastcgi_cache_use_stale error timeout updating http_500 http_503;
22 # If in cache as stale, serve stale and update in background
23 fastcgi_cache_background_update on;
24 # Enable revalidation using If-Modified-Since and If-None-Match for stale items
25 fastcgi_cache_revalidate on;
29 fastcgi_catch_stderr "Image handling error";
31 fastcgi_next_upstream error timeout invalid_header http_500 http_503;
32 fastcgi_next_upstream_tries 8;
37 # Add HTTP Cache-Control + Expires Headers
39 add_header Cache-Control "stale-while-revalidate=604800, stale-if-error=604800";
40 add_header x-cache-status $upstream_cache_status;
43 add_header 'Access-Control-Allow-Origin' '*';
47 rewrite "^/(\d+)/(\d+)/(\d+)\.(png|jpg|jpeg)$" "/layer/<%= @layer %>/$1/$2/$3.$4" last;
49 <% @url_aliases.each do |url| -%>
50 rewrite "^<%= url %>/(\d+)/(\d+)/(\d+)\.(png|jpg|jpeg)$" "/layer/<%= @layer %>/$1/$2/$3.$4" last;