mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2024-11-18 10:29:43 +00:00
6c63b66ce4
we have big functions that handle all stuff ... we should split this into smaler chuncks so we could test them seperate and make clear cuts in what happens where Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/135
15 lines
429 B
Go
15 lines
429 B
Go
package handler
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
// 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 {
|
|
if strings.HasSuffix(host, mainDomainSuffix) || strings.EqualFold(host, rawDomain) {
|
|
return "max-age=63072000; includeSubdomains; preload"
|
|
} else {
|
|
return ""
|
|
}
|
|
}
|