mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2024-11-05 14:07:01 +00:00
more log
This commit is contained in:
parent
a03ea956d5
commit
218b52094e
3 changed files with 5 additions and 4 deletions
|
@ -46,7 +46,7 @@ func Handler(mainDomainSuffix, rawDomain string,
|
|||
trimmedHost := utils.TrimHostPort(req.Host)
|
||||
|
||||
// Add HSTS for RawDomain and MainDomainSuffix
|
||||
if hsts := GetHSTSHeader(trimmedHost, mainDomainSuffix, rawDomain); hsts != "" {
|
||||
if hsts := getHSTSHeader(trimmedHost, mainDomainSuffix, rawDomain); hsts != "" {
|
||||
ctx.RespWriter.Header().Set("Strict-Transport-Security", hsts)
|
||||
}
|
||||
|
||||
|
@ -92,6 +92,7 @@ func Handler(mainDomainSuffix, rawDomain string,
|
|||
|
||||
// tryBranch checks if a branch exists and populates the target variables. If canonicalLink is non-empty, it will
|
||||
// also disallow search indexing and add a Link header to the canonical URL.
|
||||
// TODO: move into external func to not alert vars indirectly
|
||||
tryBranch := func(log zerolog.Logger, repo, branch string, _path []string, canonicalLink string) bool {
|
||||
if repo == "" {
|
||||
log.Debug().Msg("tryBranch: repo == ''")
|
||||
|
|
|
@ -4,9 +4,9 @@ import (
|
|||
"strings"
|
||||
)
|
||||
|
||||
// GetHSTSHeader returns a HSTS header with includeSubdomains & preload for MainDomainSuffix and RawDomain, or an empty
|
||||
// getHSTSHeader returns a HSTS header with includeSubdomains & preload for MainDomainSuffix and RawDomain, or an empty
|
||||
// string for custom domains.
|
||||
func GetHSTSHeader(host, mainDomainSuffix, rawDomain string) string {
|
||||
func getHSTSHeader(host, mainDomainSuffix, rawDomain string) string {
|
||||
if strings.HasSuffix(host, mainDomainSuffix) || strings.EqualFold(host, rawDomain) {
|
||||
return "max-age=63072000; includeSubdomains; preload"
|
||||
} else {
|
||||
|
|
|
@ -18,7 +18,7 @@ func GetBranchTimestamp(giteaClient *gitea.Client, owner, repo, branch string) *
|
|||
log.Err(err).Msg("Could't fetch default branch from repository")
|
||||
return nil
|
||||
}
|
||||
log.Debug().Msgf("found default branch: %s", defaultBranch)
|
||||
log.Debug().Msgf("Succesfully fetched default branch '%s' from Gitea", defaultBranch)
|
||||
branch = defaultBranch
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue