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_send_timeout 600;
|
||||||
proxy_read_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
|
# ДЕТАЛЬНЫЕ НАСТРОЙКИ CORS ДЛЯ OPTIONS
|
||||||
# ========================================
|
# ========================================
|
||||||
|
|||||||
@@ -21,7 +21,7 @@ type Config struct {
|
|||||||
func Load() *Config {
|
func Load() *Config {
|
||||||
return &Config{
|
return &Config{
|
||||||
DBHost: getEnv("DB_HOST", "localhost"),
|
DBHost: getEnv("DB_HOST", "localhost"),
|
||||||
DBPort: getEnv("DB_PORT", "5432"),
|
DBPort: getEnv("DB_PORT", "5432"),
|
||||||
DBUser: getEnv("DB_USER", "postgres"),
|
DBUser: getEnv("DB_USER", "postgres"),
|
||||||
DBPassword: getEnv("DB_PASSWORD", "postgres"),
|
DBPassword: getEnv("DB_PASSWORD", "postgres"),
|
||||||
DBName: getEnv("DB_NAME", "mydb"),
|
DBName: getEnv("DB_NAME", "mydb"),
|
||||||
|
|||||||
Reference in New Issue
Block a user