From 6022367de4165f3a94483c6a86d0ee5f631ccdeb Mon Sep 17 00:00:00 2001 From: Ivan Gabaldon Date: Sat, 14 Jun 2025 15:21:40 +0200 Subject: [PATCH] [mod] caddy: trusted proxies support (#396) Early preparation for https://github.com/searxng/searxng/pull/4911 --- Caddyfile | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Caddyfile b/Caddyfile index 655b7b4..15f1489 100644 --- a/Caddyfile +++ b/Caddyfile @@ -18,6 +18,15 @@ } } } + + servers { + client_ip_headers X-Forwarded-For X-Real-IP + + # Allow the following IP to passthrough the "X-Forwarded-*" headers to SearXNG + # https://caddyserver.com/docs/caddyfile/options#trusted-proxies + trusted_proxies static private_ranges + trusted_proxies_strict + } } {$SEARXNG_HOSTNAME} @@ -81,11 +90,8 @@ route { header @static Cache-Control "max-age=31536000, public, immutable" } -# SearXNG (uWSGI) +# SearXNG reverse_proxy localhost:8080 { - header_up X-Forwarded-Port {http.request.port} - header_up X-Real-IP {http.request.remote.host} - # https://github.com/searx/searx-docker/issues/24 header_up Connection "close" }