mirror of
https://codeberg.org/crowci/crow.git
synced 2025-08-12 06:02:53 +03:00
Fix usage of WOODPECKER_ROOT_PATH (#2485)
I had experienced some issues running Woodpecker behind a reverse-proxy, resulting from not defining the `WOODPECKER_ROOT_PATH` environment variable in #2477. As suggested by @qwerty287, specifying `WOODPECKER_ROOT_PATH=/foo` *mostly* solved the issue of running the woodpecker server at an url like `https://example.org/foo`. However, the webhook urls and badge urls were generated excluding the configured `WOODPECKER_ROOT_PATH`. This PR (mostly) fixes issues related to non-empty `WOODPECKER_ROOT_PATH`. --------- Co-authored-by: qwerty287 <80460567+qwerty287@users.noreply.github.com>
This commit is contained in:
@@ -400,9 +400,9 @@ func (c *client) newConfig(req *http.Request) *oauth2.Config {
|
||||
|
||||
intendedURL := req.URL.Query()["url"]
|
||||
if len(intendedURL) > 0 {
|
||||
redirect = fmt.Sprintf("%s%s/authorize?url=%s", server.Config.Server.OAuthHost, server.Config.Server.RootPath, intendedURL[0])
|
||||
redirect = fmt.Sprintf("%s/authorize?url=%s", server.Config.Server.OAuthHost, intendedURL[0])
|
||||
} else {
|
||||
redirect = fmt.Sprintf("%s%s/authorize", server.Config.Server.OAuthHost, server.Config.Server.RootPath)
|
||||
redirect = fmt.Sprintf("%s/authorize", server.Config.Server.OAuthHost)
|
||||
}
|
||||
|
||||
return &oauth2.Config{
|
||||
|
Reference in New Issue
Block a user