Skip to content

Commit

Permalink
fix(backend): improve extract domain function
Browse files Browse the repository at this point in the history
  • Loading branch information
Björn Urban committed Oct 16, 2023
1 parent 3e895ea commit b45493f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions backend/internal/handlers/auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -266,17 +266,17 @@ func (h *Handler) getRedirectFromCookie(r *http.Request, w http.ResponseWriter)
}
func (h *Handler) getRedirectUrl(r *http.Request) (string, error) {
// Extract the redirect parameter from the request to get the site URL.
printHeaders(r)

siteURL := r.Header.Get("X-Forwarded-Uri")
if siteURL == "" {
siteURL = r.Header.Get("Referer")
}
if siteURL == "" {
siteURL = r.URL.Query().Get("redirect")
}
if siteURL == "" {
printHeaders(r)
return "", fmt.Errorf("Redirect URL missing from both header and URL parameter")
if siteURL == "" {
siteURL = r.URL.Query().Get("redirect")
if siteURL == "" {
return "", fmt.Errorf("Redirect URL missing from both header and URL parameter")
}
}
}
return siteURL, nil
}
Expand Down

0 comments on commit b45493f

Please sign in to comment.