diff --git a/CHANGELOG.md b/CHANGELOG.md index 0805a6b..cc3171a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ - [#68](https://github.com/pusher/oauth2_proxy/pull/68) forward X-Auth-Access-Token header (@davidholsgrove) - [#41](https://github.com/pusher/oauth2_proxy/pull/41) Added option to manually specify OIDC endpoints instead of relying on discovery - [#83](https://github.com/pusher/oauth2_proxy/pull/83) Add `id_token` refresh to Google provider (@leki75) +- [#10](https://github.com/pusher/oauth2_proxy/pull/10) fix redirect url param handling (@dt-rush) # v3.1.0 diff --git a/oauthproxy.go b/oauthproxy.go index 68b1522..941e934 100644 --- a/oauthproxy.go +++ b/oauthproxy.go @@ -183,7 +183,9 @@ func NewOAuthProxy(opts *Options, validator func(string) bool) *OAuthProxy { } redirectURL := opts.redirectURL - redirectURL.Path = fmt.Sprintf("%s/callback", opts.ProxyPrefix) + if redirectURL.String() == "" { + redirectURL.Path = fmt.Sprintf("%s/callback", opts.ProxyPrefix) + } log.Printf("OAuthProxy configured for %s Client ID: %s", opts.provider.Data().ProviderName, opts.ClientID) refresh := "disabled" @@ -218,7 +220,7 @@ func NewOAuthProxy(opts *Options, validator func(string) bool) *OAuthProxy { SignInPath: fmt.Sprintf("%s/sign_in", opts.ProxyPrefix), SignOutPath: fmt.Sprintf("%s/sign_out", opts.ProxyPrefix), OAuthStartPath: fmt.Sprintf("%s/start", opts.ProxyPrefix), - OAuthCallbackPath: fmt.Sprintf("%s/callback", opts.ProxyPrefix), + OAuthCallbackPath: redirectURL.Path, AuthOnlyPath: fmt.Sprintf("%s/auth", opts.ProxyPrefix), ProxyPrefix: opts.ProxyPrefix,