From 58e001c3d5165ee5eed935e4398134eafcf6b7a9 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 14 Feb 2023 14:31:04 +0100 Subject: [PATCH] internal: fix scheme not being forwarded correctly for host intercepted requests Signed-off-by: Jens Langhammer --- internal/utils/web/http_host_interceptor.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/internal/utils/web/http_host_interceptor.go b/internal/utils/web/http_host_interceptor.go index d3c7de862..ab2308e7f 100644 --- a/internal/utils/web/http_host_interceptor.go +++ b/internal/utils/web/http_host_interceptor.go @@ -8,12 +8,14 @@ import ( ) type hostInterceptor struct { - inner http.RoundTripper - host string + inner http.RoundTripper + host string + scheme string } func (t hostInterceptor) RoundTrip(r *http.Request) (*http.Response, error) { r.Host = t.host + r.Header.Set("X-Forwarded-Proto", t.scheme) return t.inner.RoundTrip(r) } @@ -24,8 +26,9 @@ func NewHostInterceptor(inner *http.Client, host string) *http.Client { } return &http.Client{ Transport: hostInterceptor{ - inner: inner.Transport, - host: aku.Host, + inner: inner.Transport, + host: aku.Host, + scheme: aku.Scheme, }, } }