From 27c8b1a0613ee2477bb2732f9ca911f218c0cd8b Mon Sep 17 00:00:00 2001 From: Yee Date: Fri, 7 Aug 2026 11:32:43 +0800 Subject: [PATCH] fix(nginx): use 127.0.0.1 in python conf to avoid ~1s IPv6 fallback latency (#17909) ## Problem In the default deployment (`API_PROXY_SCHEME=python`), the nginx config generated from `docker/nginx/ragflow.conf.python` uses: ```nginx proxy_pass http://localhost:9381; # admin proxy_pass http://localhost:9380; # api ``` Inside the RAGFlow container, `/etc/hosts` maps `localhost` to both `127.0.0.1` and `::1`: ``` 127.0.0.1 localhost ::1 localhost ip6-localhost ip6-loopback ``` But the backend services (`ragflow_server.py` on 9380, admin server on 9381) only listen on IPv4 (`127.0.0.1`). When nginx resolves `localhost` to `::1`, the upstream connection fails and nginx falls back to the IPv4 address - each fallback adds ~1 second of latency. Co-authored-by: Jin Hai --- docker/nginx/ragflow.conf.python | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/nginx/ragflow.conf.python b/docker/nginx/ragflow.conf.python index d000e41519..0d62e32417 100644 --- a/docker/nginx/ragflow.conf.python +++ b/docker/nginx/ragflow.conf.python @@ -11,12 +11,12 @@ server { gzip_disable "MSIE [1-6]\."; location ~ ^/api/v1/admin { - proxy_pass http://localhost:9381; + proxy_pass http://127.0.0.1:9381; include proxy.conf; } location ~ ^/(v1|api) { - proxy_pass http://localhost:9380; + proxy_pass http://127.0.0.1:9380; include proxy.conf; }