mirror of
https://codeberg.org/Codeberg/pages-server
synced 2025-04-08 13:48:14 +00:00
close #100 close #109 close #113 close #28 close #63 Reviewed-on: https://codeberg.org/Codeberg/pages-server/pulls/106
15 lines
428 B
Go
15 lines
428 B
Go
package server
|
|
|
|
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 ""
|
|
}
|
|
}
|