fix(admin-ui): resolver 169.254.25.10 для dynamic proxy_pass

Nginx с переменной в proxy_pass требует resolver. Ставим nodelocal-dns
(169.254.25.10 на kubespray-кластерах) с публичным fallback (1.1.1.1).
Это снимает 502 Bad Gateway на /api/v1/* — раньше nginx не мог
зарезолвить ordinis-read-api/ordinis-app в момент запроса.
This commit is contained in:
Александр Зимин
2026-05-04 01:16:09 +03:00
parent 1b1d8c956a
commit 8e97c50e6c
+6 -4
View File
@@ -2,18 +2,19 @@ server {
listen 80; listen 80;
server_name _; server_name _;
# Resolver для динамического k8s service DNS (proxy_pass с переменной).
# 169.254.25.10 — nodelocal-dns на kubespray-кластерах (cluster.265 и .264).
resolver 169.254.25.10 1.1.1.1 valid=30s ipv6=off;
# Real client IP behind ingress-nginx. # Real client IP behind ingress-nginx.
set_real_ip_from 0.0.0.0/0; set_real_ip_from 0.0.0.0/0;
real_ip_header X-Forwarded-For; real_ip_header X-Forwarded-For;
real_ip_recursive on; real_ip_recursive on;
# SPA history fallback.
root /usr/share/nginx/html; root /usr/share/nginx/html;
index index.html; index index.html;
# GET /api/v1/dictionaries и /api/v1/<name>/records → read-api. # GET → read-api, мутирующие → writer.
# POST/PUT/PATCH/DELETE на тех же путях → writer (ordinis-app).
# Method-based routing через map.
location /api/v1/ { location /api/v1/ {
set $backend "ordinis-read-api"; set $backend "ordinis-read-api";
if ($request_method ~ ^(POST|PUT|PATCH|DELETE)$) { if ($request_method ~ ^(POST|PUT|PATCH|DELETE)$) {
@@ -28,6 +29,7 @@ server {
proxy_pass_request_headers on; proxy_pass_request_headers on;
} }
# SPA history fallback.
location / { location / {
try_files $uri $uri/ /index.html; try_files $uri $uri/ /index.html;
} }