proxy auth add x-forwarded headers.

This commit is contained in:
Miroslav Šedivý
2022-08-04 00:23:47 +02:00
parent 3b7f8091f8
commit 9bc34e38c9
+8
View File
@@ -7,6 +7,7 @@ import (
"os"
"path"
"path/filepath"
"strings"
"time"
"github.com/go-chi/chi"
@@ -79,6 +80,13 @@ func New(ApiManager types.ApiManager, roomConfig *config.Room, config *config.Se
}
}
// add x-forwarded headers
r.Header.Add("X-Forwarded-Method", r.Method)
r.Header.Add("X-Forwarded-Proto", strings.TrimRight(r.URL.Scheme, ":"))
r.Header.Add("X-Forwarded-Host", r.URL.Host)
r.Header.Add("X-Forwarded-Uri", r.URL.Path)
r.Header.Add("X-Forwarded-For", r.RemoteAddr)
client := &http.Client{
CheckRedirect: func(req *http.Request, via []*http.Request) error {
return http.ErrUseLastResponse