Files
flights_web/deployment/nginx/conf.d/flights-api-cache.conf
T
gnezim b0e9aafed2 WAF rate-limit mitigation: nginx /api cache + Playwright throttle
(A) Add proxy_cache zone for ui-dashboard.gnerim.ru. /api/ caches 200 for
1m, /map/api/ for 24h. proxy_cache_use_stale serves cached content during
upstream errors (incl. 403 from WAF rate limit). proxy_cache_lock collapses
concurrent fetches for the same URI. Cache zone declared in conf.d/ (must
be in http{} context).

(B) Playwright workers=2, retries=2 in CI. Cuts the parallel burst that
trips the WAF before nginx cache warms up; retries handle the residual
flake.

setup-pve201.sh now installs the conf.d cache file and pre-creates the
cache dir with nginx-user ownership.
2026-04-27 16:40:44 +03:00

16 lines
702 B
Plaintext

# Cache zone for ui-dashboard.gnerim.ru /api/* and /map/api/* upstreams.
# Lives in /etc/nginx/conf.d/ because proxy_cache_path is only valid in the
# http {} context, not inside server {}.
#
# Why we need it: flights.test.aeroflot.ru's WAF has a per-source-IP rate
# limit (~25-30 fresh TCP connections per window) that the parallel e2e
# burst trips. Caching read-only GETs by the customer-facing nginx layer
# absorbs the burst — only one request per (URI, window) reaches the WAF.
proxy_cache_path /var/cache/nginx/flights-api
levels=1:2
keys_zone=flights_api:10m
max_size=200m
inactive=30m
use_temp_path=off;