mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-12 00:44:07 +00:00
add base case to break recusion
This commit is contained in:
parent
ef7e2cd7bb
commit
5303eaad70
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 {
|
for _, redirect := range redirects {
|
||||||
if dstURL, ok := redirect.rewriteURL(reqURL); ok {
|
if dstURL, ok := redirect.rewriteURL(reqURL); ok {
|
||||||
// do rewrite if status code is 200
|
if o.TargetPath == dstURL { // recursion base case, rewrite directly when paths are the same
|
||||||
if redirect.StatusCode == 200 {
|
return true
|
||||||
|
} else if redirect.StatusCode == 200 { // do rewrite if status code is 200
|
||||||
o.TargetPath = dstURL
|
o.TargetPath = dstURL
|
||||||
o.Upstream(ctx, giteaClient, redirectsCache)
|
o.Upstream(ctx, giteaClient, redirectsCache)
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Reference in a new issue