mirror of
https://github.com/m1k1o/neko-rooms.git
synced 2026-11-02 22:51:34 -06:00
proxy auth add x-forwarded headers.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user