mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-19 12:54:24 +02:00
Move redirects to fix SPA rewrite
This commit is contained in:
parent
fa769b728e
commit
875094e718
1 changed files with 7 additions and 3 deletions
|
@ -104,6 +104,12 @@ func (o *Options) Upstream(ctx *context.Context, giteaClient *gitea.Client, redi
|
|||
|
||||
// Handle not found error
|
||||
if err != nil && errors.Is(err, gitea.ErrorNotFound) {
|
||||
// Get and match redirects
|
||||
redirects := o.getRedirects(giteaClient, redirectsCache)
|
||||
if o.matchRedirects(ctx, giteaClient, redirects, redirectsCache) {
|
||||
return true
|
||||
}
|
||||
|
||||
if o.TryIndexPages {
|
||||
// copy the o struct & try if an index page exists
|
||||
optionsForIndexPages := *o
|
||||
|
@ -138,9 +144,7 @@ func (o *Options) Upstream(ctx *context.Context, giteaClient *gitea.Client, redi
|
|||
}
|
||||
}
|
||||
|
||||
// Get and match redirects
|
||||
redirects := o.getRedirects(giteaClient, redirectsCache)
|
||||
return o.matchRedirects(ctx, giteaClient, redirects, redirectsCache)
|
||||
return false
|
||||
}
|
||||
|
||||
// handle unexpected client errors
|
||||
|
|
Loading…
Add table
Reference in a new issue