server { listen 80; server_name _; # Real client IP behind ingress-nginx. set_real_ip_from 0.0.0.0/0; real_ip_header X-Forwarded-For; real_ip_recursive on; # SPA history fallback. root /usr/share/nginx/html; index index.html; # GET /api/v1/dictionaries и /api/v1//records → read-api. # POST/PUT/PATCH/DELETE на тех же путях → writer (ordinis-app). # Method-based routing через map. location /api/v1/ { set $backend "ordinis-read-api"; if ($request_method ~ ^(POST|PUT|PATCH|DELETE)$) { set $backend "ordinis-app"; } proxy_pass http://$backend; proxy_http_version 1.1; 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_pass_request_headers on; } location / { try_files $uri $uri/ /index.html; } }