Made project use a callback provider to avoid letting almost the whole world on blank
This commit is contained in:
+18
-1
@@ -8,10 +8,27 @@ server {
|
||||
|
||||
# Public API is x/y/z. try_files performs an internal lookup at z/x/y.png.
|
||||
location ~ ^/tiles/(?<tile_x>[0-9]+)/(?<tile_y>[0-9]+)/(?<tile_z>[0-9]+)$ {
|
||||
try_files /tiles/$tile_z/$tile_x/$tile_y.png =404;
|
||||
if ($request_method = OPTIONS) {
|
||||
add_header Access-Control-Allow-Origin "*" always;
|
||||
add_header Access-Control-Allow-Methods "GET, HEAD, OPTIONS" always;
|
||||
add_header Access-Control-Allow-Headers "Origin, Range, Accept" always;
|
||||
add_header Content-Length 0;
|
||||
return 204;
|
||||
}
|
||||
try_files /tiles/$tile_z/$tile_x/$tile_y.png @callback_provider_tile;
|
||||
add_header Cache-Control "public, max-age=86400, stale-while-revalidate=604800" always;
|
||||
add_header Access-Control-Allow-Origin "*" always;
|
||||
add_header Access-Control-Allow-Methods "GET, HEAD, OPTIONS" always;
|
||||
add_header Access-Control-Allow-Headers "Origin, Range, Accept" always;
|
||||
}
|
||||
|
||||
# A callback-provider base layer fills transparent edges when configured.
|
||||
location ~ ^/base/(?<base_x>[0-9]+)/(?<base_y>[0-9]+)/(?<base_z>[0-9]+)$ {
|
||||
try_files /__callback_provider_base__ @callback_provider_base;
|
||||
}
|
||||
|
||||
include /etc/nginx/includes/callback-provider.conf;
|
||||
|
||||
# metadata.json and internal z/x/y.png paths are intentionally not public.
|
||||
location / {
|
||||
return 404;
|
||||
|
||||
Reference in New Issue
Block a user