internal: fix scheme not being forwarded correctly for host intercepted requests

Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
Jens Langhammer 2023-02-14 14:31:04 +01:00
parent 54ac920f81
commit 58e001c3d5
No known key found for this signature in database
1 changed files with 7 additions and 4 deletions

View File

@ -10,10 +10,12 @@ import (
type hostInterceptor struct {
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)
}
@ -26,6 +28,7 @@ func NewHostInterceptor(inner *http.Client, host string) *http.Client {
Transport: hostInterceptor{
inner: inner.Transport,
host: aku.Host,
scheme: aku.Scheme,
},
}
}