Фикс заголовков для локальной карты

This commit is contained in:
2025-12-09 10:59:44 +03:00
parent 25fe93231f
commit 8393734dc3
8 changed files with 34 additions and 7 deletions

View File

@@ -27,6 +27,32 @@ server {
add_header Cache-Control "public, max-age=2592000";
}
# Прокси для tileserver-gl с CORS заголовками
location /tiles/ {
proxy_pass http://tileserver:8080/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
# CORS заголовки
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS' always;
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length,Content-Range' always;
# Обработка preflight запросов
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Allow-Methods' 'GET, POST, OPTIONS';
add_header 'Access-Control-Allow-Headers' 'DNT,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Range';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain; charset=utf-8';
add_header 'Content-Length' 0;
return 204;
}
}
# Прокси для всех остальных запросов на Django (асинхронный / uvicorn или gunicorn)
location / {
proxy_pass http://django;