fix(nginx): static proxy_pass hostname so DNS resolves once at config-load
The previous $variable form forced lazy per-request DNS resolution. Per-request lookups against 10.43.0.10 → SERVFAIL → cold-cache 502 even when downstream was healthy. Switching to a literal hostname makes nginx resolve once at startup and reuse the cached upstream IP for the lifetime of the worker. Cloudflare anycast is stable so this is safe.
This commit is contained in:
+7
-5
@@ -28,12 +28,14 @@ server {
|
||||
resolver 10.43.0.10 1.1.1.1 8.8.8.8 valid=30s ipv6=off;
|
||||
|
||||
# Reverse-proxy /api to the demo backend so live mode is same-origin.
|
||||
# Pinned to the Cloudflare anycast IP for canvas.flow-master.ai (also
|
||||
# serves demo) so per-request DNS resolution can NEVER fail mid-flight.
|
||||
# 30s connect, 30s read, retry once on transient upstream failure.
|
||||
# NOTE: proxy_pass uses a literal hostname (not a $variable) so nginx
|
||||
# resolves demo.flow-master.ai ONCE at config-load, caches it for the
|
||||
# lifetime of the worker, and never retries DNS mid-request. This is
|
||||
# the only way to eliminate the per-request DNS race that returned
|
||||
# fast 502s on cold cache. Cloudflare hides the demo origin behind
|
||||
# anycast IPs, so a single-resolution lookup is safe and stable.
|
||||
location /api/ {
|
||||
set $upstream_demo "https://demo.flow-master.ai";
|
||||
proxy_pass $upstream_demo;
|
||||
proxy_pass https://demo.flow-master.ai;
|
||||
proxy_set_header Host demo.flow-master.ai;
|
||||
proxy_set_header X-Forwarded-Proto https;
|
||||
proxy_set_header X-Forwarded-Host $host;
|
||||
|
||||
Reference in New Issue
Block a user