mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-04-24 22:06:57 +00:00
Merge branch 'main' into issue115
This commit is contained in:
commit
bbf85590c4
3 changed files with 2 additions and 3 deletions
|
@ -16,6 +16,7 @@ import (
|
||||||
const (
|
const (
|
||||||
headerAccessControlAllowOrigin = "Access-Control-Allow-Origin"
|
headerAccessControlAllowOrigin = "Access-Control-Allow-Origin"
|
||||||
headerAccessControlAllowMethods = "Access-Control-Allow-Methods"
|
headerAccessControlAllowMethods = "Access-Control-Allow-Methods"
|
||||||
|
defaultPagesRepo = "pages"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Handler handles a single HTTP request to the web server.
|
// Handler handles a single HTTP request to the web server.
|
||||||
|
|
|
@ -15,8 +15,6 @@ import (
|
||||||
"codeberg.org/codeberg/pages/server/upstream"
|
"codeberg.org/codeberg/pages/server/upstream"
|
||||||
)
|
)
|
||||||
|
|
||||||
const defaultPagesRepo = "pages"
|
|
||||||
|
|
||||||
func handleSubDomain(log zerolog.Logger, ctx *context.Context, giteaClient *gitea.Client,
|
func handleSubDomain(log zerolog.Logger, ctx *context.Context, giteaClient *gitea.Client,
|
||||||
mainDomainSuffix string,
|
mainDomainSuffix string,
|
||||||
defaultPagesBranches []string,
|
defaultPagesBranches []string,
|
||||||
|
|
|
@ -24,7 +24,7 @@ func tryUpstream(ctx *context.Context, giteaClient *gitea.Client,
|
||||||
canonicalDomain, _ := options.CheckCanonicalDomain(giteaClient, "", string(mainDomainSuffix), canonicalDomainCache)
|
canonicalDomain, _ := options.CheckCanonicalDomain(giteaClient, "", string(mainDomainSuffix), canonicalDomainCache)
|
||||||
if !strings.HasSuffix(strings.SplitN(canonicalDomain, "/", 2)[0], string(mainDomainSuffix)) {
|
if !strings.HasSuffix(strings.SplitN(canonicalDomain, "/", 2)[0], string(mainDomainSuffix)) {
|
||||||
canonicalPath := ctx.Req.RequestURI
|
canonicalPath := ctx.Req.RequestURI
|
||||||
if options.TargetRepo != "pages" {
|
if options.TargetRepo != defaultPagesRepo {
|
||||||
path := strings.SplitN(canonicalPath, "/", 3)
|
path := strings.SplitN(canonicalPath, "/", 3)
|
||||||
if len(path) >= 3 {
|
if len(path) >= 3 {
|
||||||
canonicalPath = "/" + path[2]
|
canonicalPath = "/" + path[2]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue