This commit is contained in:
@@ -2,8 +2,6 @@ package web
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"net/url"
|
||||
"strings"
|
||||
"time"
|
||||
|
||||
"git.zaynet.fr/DoGaMa/DoGaMa-serv/internal/webaccess"
|
||||
@@ -116,8 +114,3 @@ func (s *server) languageSelect(w http.ResponseWriter, r *http.Request) {
|
||||
s.setCookie(w, r, languageCookie, language, time.Now().Add(365*24*time.Hour), true)
|
||||
http.Redirect(w, r, target, http.StatusSeeOther)
|
||||
}
|
||||
|
||||
func canonicalURL(value string) *url.URL { u, _ := url.Parse(value); return u }
|
||||
func canonicalMatches(r *http.Request, canonical string) bool {
|
||||
return strings.TrimSuffix(requestBaseURL(r), "/") == strings.TrimSuffix(canonical, "/")
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ func (p Policy) Validate() (Policy, error) {
|
||||
return Policy{}, err
|
||||
}
|
||||
if p.RequireHTTPS && canonical != "" && !strings.HasPrefix(canonical, "https://") {
|
||||
return Policy{}, errors.New("Require HTTPS requires an HTTPS canonical base URL")
|
||||
return Policy{}, errors.New("require HTTPS requires an HTTPS canonical base URL")
|
||||
}
|
||||
p.CanonicalURL = canonical
|
||||
return p, nil
|
||||
|
||||
Reference in New Issue
Block a user