From 5b7a408568b17b552f7e85ddaef729bed8d7c423 Mon Sep 17 00:00:00 2001 From: NixM0nk3y Date: Mon, 4 Sep 2023 01:34:48 +0100 Subject: [PATCH 1/2] Support non-root prefixed reverse proxy environments (#45) * support X-Forwarded-Prefix for reverse proxied prefix stripping environments * sign cla --------- Co-authored-by: Nick Gregory Co-authored-by: Paul Greenberg --- assets/cla/consent.yaml | 2 ++ pkg/util/addr/utils.go | 4 ++++ pkg/util/redirect.go | 2 ++ 3 files changed, 8 insertions(+) diff --git a/assets/cla/consent.yaml b/assets/cla/consent.yaml index 1241daa..a5958a6 100644 --- a/assets/cla/consent.yaml +++ b/assets/cla/consent.yaml @@ -37,3 +37,5 @@ email: sergiucozma1994@gmail.com - name: Riccardo Piola email: riccardopiola@live.it +- name: Nick Gregory + email: ng-cla@openenterprise.co.uk diff --git a/pkg/util/addr/utils.go b/pkg/util/addr/utils.go index 81a2016..4111ccd 100644 --- a/pkg/util/addr/utils.go +++ b/pkg/util/addr/utils.go @@ -169,6 +169,10 @@ func GetCurrentURLWithSuffix(r *http.Request, suffix string) (string, error) { u += ":" + port } } + + prefix := r.Header.Get("X-Forwarded-Prefix") + u += prefix + if suffix != "" { i := strings.Index(r.RequestURI, suffix) if i < 0 { diff --git a/pkg/util/redirect.go b/pkg/util/redirect.go index 7174feb..d335c9f 100644 --- a/pkg/util/redirect.go +++ b/pkg/util/redirect.go @@ -96,6 +96,8 @@ func GetCurrentBaseURL(r *http.Request) string { redirectBaseURL += ":" + redirPort } } + redirPrefix := r.Header.Get("X-Forwarded-Prefix") + redirectBaseURL += redirPrefix return redirectBaseURL } From 50f3edc60f01348d580c769761097734f4f0527e Mon Sep 17 00:00:00 2001 From: Paul Greenberg Date: Sun, 3 Sep 2023 20:35:55 -0400 Subject: [PATCH 2/2] released v1.0.41 --- VERSION | 2 +- cmd/authdbctl/main.go | 4 ++-- pkg/identity/database.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/VERSION b/VERSION index cd63089..8ef0958 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.0.40 \ No newline at end of file +1.0.41 \ No newline at end of file diff --git a/cmd/authdbctl/main.go b/cmd/authdbctl/main.go index 70fef50..5072522 100644 --- a/cmd/authdbctl/main.go +++ b/cmd/authdbctl/main.go @@ -37,9 +37,9 @@ func init() { app = versioned.NewPackageManager("authdbctl") app.Description = "AuthDB management client" app.Documentation = "https://github.com/greenpau/go-authcrunch/" - app.SetVersion(appVersion, "1.0.40") + app.SetVersion(appVersion, "1.0.41") app.SetGitBranch(gitBranch, "main") - app.SetGitCommit(gitCommit, "v1.0.39-3-gba18559") + app.SetGitCommit(gitCommit, "v1.0.40-3-g5b7a408") app.SetBuildUser(buildUser, "") app.SetBuildDate(buildDate, "") diff --git a/pkg/identity/database.go b/pkg/identity/database.go index 54edec1..184fa58 100644 --- a/pkg/identity/database.go +++ b/pkg/identity/database.go @@ -61,9 +61,9 @@ func init() { app = versioned.NewPackageManager("authdb") app.Description = "authdb" app.Documentation = "https://github.com/greenpau/go-authcrunch" - app.SetVersion(appVersion, "1.0.40") + app.SetVersion(appVersion, "1.0.41") app.SetGitBranch(gitBranch, "main") - app.SetGitCommit(gitCommit, "v1.0.39-3-gba18559") + app.SetGitCommit(gitCommit, "v1.0.40-3-g5b7a408") app.SetBuildUser(buildUser, "") app.SetBuildDate(buildDate, "") }