From 85d51a300eb75a36387cfe463e58a13d5a72d55d Mon Sep 17 00:00:00 2001 From: Laurence Date: Fri, 8 May 2026 13:45:50 +0100 Subject: [PATCH] fix(http): Set host header based on in fix https://github.com/fosrl/pangolin/issues/2952 issue by setting the incoming host header to the outgoing one by the reverse proxy, this was the default behaviour when using single proxy but now since we use more features it now rewrites the host header Former-commit-id: 6aa94c0c2a4861378a468e0280d6e6cdc2db6ab3 --- netstack2/http_handler.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/netstack2/http_handler.go b/netstack2/http_handler.go index 7ba2f63..ed39d1e 100644 --- a/netstack2/http_handler.go +++ b/netstack2/http_handler.go @@ -291,6 +291,9 @@ func (h *HTTPHandler) getProxy(target HTTPTarget) *httputil.ReverseProxy { proxy := &httputil.ReverseProxy{ Rewrite: func(pr *httputil.ProxyRequest) { pr.SetURL(targetURL) + if host := pr.In.Host; host != "" { + pr.Out.Host = host + } // SetXForwarded sets X-Forwarded-For from the inbound request's // RemoteAddr (the WireGuard/netstack client address), along with // X-Forwarded-Host and X-Forwarded-Proto. Using Rewrite instead of