On branch main
modified: main_dc/nginx/nginx-ssl.conf modified: main_dc/yalarba/api_es/internal/config/config.go add config into enginx for api_yal REST_API
This commit is contained in:
@@ -278,6 +278,45 @@ server {
|
||||
proxy_send_timeout 600;
|
||||
proxy_read_timeout 600;
|
||||
|
||||
# ========================================
|
||||
# ДЕТАЛЬНЫЕ НАСТРОЙКИ CORS ДЛЯ OPTIONS
|
||||
# ========================================
|
||||
if ($request_method = OPTIONS ) {
|
||||
# Динамический заголовок Origin из запроса
|
||||
add_header 'Access-Control-Allow-Origin' "$http_origin";
|
||||
add_header 'Access-Control-Allow-Methods' 'GET, POST, PUT, PATCH, DELETE';
|
||||
|
||||
# Подробный список разрешенных заголовков
|
||||
add_header 'Access-Control-Allow-Headers' 'DNT,X-Mx-ReqToken,Keep-Alive,User-Agent,X-Requested-With,If-Modified-Since,Cache-Control,Content-Type,Authorization';
|
||||
|
||||
# Время кэширования preflight ответа (20 дней)
|
||||
add_header 'Access-Control-Max-Age' 1728000;
|
||||
|
||||
# Пустой ответ для OPTIONS
|
||||
add_header 'Content-Length' 0;
|
||||
add_header 'Content-Type' 'text/plain charset=UTF-8';
|
||||
|
||||
# Возвращаем 204 без тела ответа
|
||||
return 204;
|
||||
}
|
||||
}
|
||||
|
||||
location /api_yal/ {
|
||||
# Отдельный API endpoint для backend
|
||||
proxy_pass http://api_yal:8787/;
|
||||
|
||||
# Заголовки прокси
|
||||
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;
|
||||
proxy_set_header X-Forwarded-Port $server_port;
|
||||
|
||||
# Таймауты как у основного приложения
|
||||
proxy_connect_timeout 600;
|
||||
proxy_send_timeout 600;
|
||||
proxy_read_timeout 600;
|
||||
|
||||
# ========================================
|
||||
# ДЕТАЛЬНЫЕ НАСТРОЙКИ CORS ДЛЯ OPTIONS
|
||||
# ========================================
|
||||
|
||||
Reference in New Issue
Block a user