diff options
| -rw-r--r-- | cmd/golangorg/server.go | 13 | ||||
| -rw-r--r-- | internal/env/env.go | 10 |
2 files changed, 7 insertions, 16 deletions
diff --git a/cmd/golangorg/server.go b/cmd/golangorg/server.go index 838eab00..f53b1725 100644 --- a/cmd/golangorg/server.go +++ b/cmd/golangorg/server.go @@ -35,7 +35,6 @@ import ( "golang.org/x/website/internal/backport/osfs" "golang.org/x/website/internal/codewalk" "golang.org/x/website/internal/dl" - "golang.org/x/website/internal/env" "golang.org/x/website/internal/gitfs" "golang.org/x/website/internal/history" "golang.org/x/website/internal/memcache" @@ -211,9 +210,7 @@ func NewHandler(contentDir, goroot string) http.Handler { mux.Handle("learn.go.dev/", redirectPrefix("https://go.dev/learn/")) var h http.Handler = mux - if env.EnforceHosts() { - h = hostEnforcerHandler(h) - } + h = hostEnforcerHandler(h) h = hostPathHandler(h) return h } @@ -362,13 +359,15 @@ func fmtHandler(w http.ResponseWriter, r *http.Request) { } var validHosts = map[string]bool{ - "go.dev": true, - "learn.go.dev": true, "golang.org": true, "golang.google.cn": true, + "beta.golang.org": true, + "blog.golang.org": true, "m.golang.org": true, "tip.golang.org": true, - "beta.golang.org": true, + + "go.dev": true, + "learn.go.dev": true, } // hostEnforcerHandler redirects http://foo.golang.org/bar to https://golang.org/bar. diff --git a/internal/env/env.go b/internal/env/env.go index 3eca79cb..007a83ab 100644 --- a/internal/env/env.go +++ b/internal/env/env.go @@ -12,10 +12,7 @@ import ( "strconv" ) -var ( - enforceHosts = boolEnv("GOLANGORG_ENFORCE_HOSTS") - requireDLSecretKey = boolEnv("GOLANGORG_REQUIRE_DL_SECRET_KEY") -) +var requireDLSecretKey = boolEnv("GOLANGORG_REQUIRE_DL_SECRET_KEY") // RequireDLSecretKey reports whether the download server secret key // is expected to already exist, and the download server should panic @@ -24,11 +21,6 @@ func RequireDLSecretKey() bool { return requireDLSecretKey } -// EnforceHosts reports whether host filtering should be enforced. -func EnforceHosts() bool { - return enforceHosts -} - func boolEnv(key string) bool { v := os.Getenv(key) if v == "" { |
