parent
cebb518e05
commit
c623792c2f
|
|
@ -123,15 +123,20 @@ func (s *Server) doAuthelia(foo http.HandlerFunc) http.HandlerFunc {
|
|||
if r2.URL.Host == "" {
|
||||
r2.URL.Host = r2.Host
|
||||
}
|
||||
r2.URL.Host, _, _ = net.SplitHostPort(r2.URL.Host)
|
||||
if r2.URL.Scheme == "" {
|
||||
r2.URL.Scheme = "https"
|
||||
}
|
||||
for _, httpreq := range []*http.Request{r, req} {
|
||||
httpreq.Header.Set("X-Original-URL", r2.URL.String())
|
||||
httpreq.Header.Set("X-Forwarded-Proto", r2.URL.Scheme)
|
||||
httpreq.Header.Set("X-Forwarded-Host", r2.URL.Host)
|
||||
httpreq.Header.Set("X-Forwarded-URI", r2.URL.String())
|
||||
for k, v := range map[string]string{
|
||||
"X-Original-Url": r2.URL.String(),
|
||||
"X-Forwarded-Proto": r2.URL.Scheme,
|
||||
"X-Forwarded-Host": r2.URL.Host,
|
||||
"X-Forwarded-Uri": r2.URL.String(),
|
||||
} {
|
||||
if _, ok := httpreq.Header[k]; !ok {
|
||||
httpreq.Header.Set(k, v)
|
||||
}
|
||||
}
|
||||
}
|
||||
if cookie, err := r.Cookie("authelia_session"); err == nil {
|
||||
req.AddCookie(cookie)
|
||||
|
|
|
|||
Loading…
Reference in New Issue