diff --git a/roles/web-svc/templates/tiles_vhost.j2 b/roles/web-svc/templates/tiles_vhost.j2 index c8f1479..36938a9 100644 --- a/roles/web-svc/templates/tiles_vhost.j2 +++ b/roles/web-svc/templates/tiles_vhost.j2 @@ -14,6 +14,8 @@ server { } } +proxy_cache_path /var/lib/nginx/cache levels=1:2 keys_zone=tilecache:10m max_size=1g; + server { listen 443 ssl http2; listen [::]:443 ssl http2; @@ -23,8 +25,29 @@ server { ssl_certificate_key /etc/nginx/ssl/{{ domain }}.key; ssl_certificate /etc/nginx/ssl/{{ domain }}.crt; - location / { - proxy_set_header X-Forwarded-For $remote_addr; - proxy_pass http://10.90.224.104:8080; + location ~ /d/(.*) { + proxy_pass http://10.90.224.104:8080/styles/basic-preview/$1; + + proxy_cache tilecache; + proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504; + proxy_cache_valid 200 1d; + proxy_cache_valid any 1m; + + proxy_ignore_headers Expires Cache-Control; + + expires 7d; + } + + location ~ /n/(.*) { + proxy_pass http://10.90.224.104:8080/styles/custom/$1; + + proxy_cache tilecache; + proxy_cache_use_stale error timeout invalid_header updating http_500 http_502 http_503 http_504; + proxy_cache_valid 200 1d; + proxy_cache_valid any 1m; + + proxy_ignore_headers Expires Cache-Control; + + expires 7d; } }