mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-01-18 16:47:54 +00:00
Fix stack overflow on root redirects (#414)
Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/414 Co-authored-by: crapStone <me@crapstone.dev> Co-committed-by: crapStone <me@crapstone.dev>
This commit is contained in:
parent
ef7e2cd7bb
commit
6376bfd2e0
1 changed files with 3 additions and 2 deletions
|
@ -92,8 +92,9 @@ func (o *Options) matchRedirects(ctx *context.Context, giteaClient *gitea.Client
|
|||
|
||||
for _, redirect := range redirects {
|
||||
if dstURL, ok := redirect.rewriteURL(reqURL); ok {
|
||||
// do rewrite if status code is 200
|
||||
if redirect.StatusCode == 200 {
|
||||
if o.TargetPath == dstURL { // recursion base case, rewrite directly when paths are the same
|
||||
return true
|
||||
} else if redirect.StatusCode == 200 { // do rewrite if status code is 200
|
||||
o.TargetPath = dstURL
|
||||
o.Upstream(ctx, giteaClient, redirectsCache)
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue