internal: fix scheme not being forwarded correctly for host intercepted requests
Signed-off-by: Jens Langhammer <jens@goauthentik.io>
This commit is contained in:
parent
54ac920f81
commit
58e001c3d5
|
@ -8,12 +8,14 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
type hostInterceptor struct {
|
type hostInterceptor struct {
|
||||||
inner http.RoundTripper
|
inner http.RoundTripper
|
||||||
host string
|
host string
|
||||||
|
scheme string
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t hostInterceptor) RoundTrip(r *http.Request) (*http.Response, error) {
|
func (t hostInterceptor) RoundTrip(r *http.Request) (*http.Response, error) {
|
||||||
r.Host = t.host
|
r.Host = t.host
|
||||||
|
r.Header.Set("X-Forwarded-Proto", t.scheme)
|
||||||
return t.inner.RoundTrip(r)
|
return t.inner.RoundTrip(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,8 +26,9 @@ func NewHostInterceptor(inner *http.Client, host string) *http.Client {
|
||||||
}
|
}
|
||||||
return &http.Client{
|
return &http.Client{
|
||||||
Transport: hostInterceptor{
|
Transport: hostInterceptor{
|
||||||
inner: inner.Transport,
|
inner: inner.Transport,
|
||||||
host: aku.Host,
|
host: aku.Host,
|
||||||
|
scheme: aku.Scheme,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue