aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorShulhan <m.shulhan@gmail.com>2023-11-10 01:15:14 +0700
committerShulhan <m.shulhan@gmail.com>2026-04-15 01:18:20 +0700
commit7e9549ca07d64fab942f05373521024eb45b2faa (patch)
tree5e12ca94b82d23bfe96aba67340e645f09898bb1
parente122483a7eb0ea0da07ed6d58ce1c8756c6f2d48 (diff)
downloadgo-x-website-7e9549ca07d64fab942f05373521024eb45b2faa.tar.xz
[DO-NOT-MERGE] cmd/golangorg: allow serving in local as "go.local"
Change-Id: I73aa112ba125b56dbdaf2727a3a7165c03de9b3f
-rw-r--r--cmd/golangorg/server.go4
-rw-r--r--internal/pkgdoc/doc.go2
2 files changed, 4 insertions, 2 deletions
diff --git a/cmd/golangorg/server.go b/cmd/golangorg/server.go
index 3b015f98..827dedba 100644
--- a/cmd/golangorg/server.go
+++ b/cmd/golangorg/server.go
@@ -552,7 +552,9 @@ func hostEnforcerHandler(h http.Handler) http.Handler {
// link back to URLs on the test site.
func hostPathHandler(h http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
- if r.Host != "localhost" && !strings.HasPrefix(r.Host, "localhost:") && !strings.HasSuffix(r.Host, ".appspot.com") {
+ if r.Host != "localhost" && !strings.HasPrefix(r.Host, "localhost:") &&
+ !strings.HasSuffix(r.Host, ".appspot.com") &&
+ !strings.HasSuffix(r.Host, `.local`) {
h.ServeHTTP(w, r)
return
}
diff --git a/internal/pkgdoc/doc.go b/internal/pkgdoc/doc.go
index 75e556df..98d48a67 100644
--- a/internal/pkgdoc/doc.go
+++ b/internal/pkgdoc/doc.go
@@ -437,7 +437,7 @@ func (d *docs) ServeHTTP(w http.ResponseWriter, r *http.Request) {
suffix += "GOARCH=" + url.QueryEscape(goarch)
}
}
- http.Redirect(w, r, "https://pkg.go.dev/"+relpath+suffix, http.StatusTemporaryRedirect)
+ http.Redirect(w, r, "https://pkg.go.local/"+relpath+suffix, http.StatusTemporaryRedirect)
return
}