mirror of
https://github.com/tobychui/zoraxy.git
synced 2025-06-03 06:07:20 +02:00
fix passing wrong URI to Authentik outpost
This commit is contained in:
parent
ebf6ad6600
commit
6a8057c3a7
@ -106,7 +106,7 @@ func (ar *AuthentikRouter) HandleAuthentikAuth(w http.ResponseWriter, r *http.Re
|
|||||||
reqUrl := scheme + "://" + r.Host + r.RequestURI
|
reqUrl := scheme + "://" + r.Host + r.RequestURI
|
||||||
// Pass request to outpost if path matches outpost prefix
|
// Pass request to outpost if path matches outpost prefix
|
||||||
if reqPath := strings.TrimPrefix(r.URL.Path, "/"); strings.HasPrefix(reqPath, outpostPrefix) {
|
if reqPath := strings.TrimPrefix(r.URL.Path, "/"); strings.HasPrefix(reqPath, outpostPrefix) {
|
||||||
req, err := http.NewRequest(r.Method, authentikBaseURL+r.URL.Path, nil)
|
req, err := http.NewRequest(r.Method, authentikBaseURL+r.RequestURI, r.Body)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ar.options.Logger.PrintAndLog("Authentik", "Unable to create request", err)
|
ar.options.Logger.PrintAndLog("Authentik", "Unable to create request", err)
|
||||||
w.WriteHeader(401)
|
w.WriteHeader(401)
|
||||||
@ -144,7 +144,7 @@ func (ar *AuthentikRouter) HandleAuthentikAuth(w http.ResponseWriter, r *http.Re
|
|||||||
return errors.New("unauthorized")
|
return errors.New("unauthorized")
|
||||||
}
|
}
|
||||||
|
|
||||||
req.Header.Add("X-Original-URL", reqUrl)
|
req.Header.Set("X-Original-URL", reqUrl)
|
||||||
|
|
||||||
// Copy cookies from the incoming request
|
// Copy cookies from the incoming request
|
||||||
for _, cookie := range r.Cookies() {
|
for _, cookie := range r.Cookies() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user