Reviewers: rsc,
Message:
Hello rsc (cc:
golan...@googlegroups.com),
I'd like you to review this change to
https://code.google.com/p/go-playground
Description:
go-playground: redirect from
foo.play.golang.org to
play.golang.org
Fixes Go project issue 4780.
Please review this at
https://codereview.appspot.com/7312075/
Affected files:
M goplay/edit.go
Index: goplay/edit.go
===================================================================
--- a/goplay/edit.go
+++ b/goplay/edit.go
@@ -12,6 +12,8 @@
"text/template"
)
+const hostname = "
play.golang.org"
+
func init() {
http.HandleFunc("/", edit)
}
@@ -23,6 +25,12 @@
}
func edit(w http.ResponseWriter, r *http.Request) {
+ // Redirect
foo.play.golang.org to
play.golang.org.
+ if strings.HasSuffix(r.Host, "."+hostname) {
+ http.Redirect(w, r, "http://"+hostname, http.StatusFound)
+ return
+ }
+
snip := &Snippet{Body: []byte(hello)}
if strings.HasPrefix(r.URL.Path, "/p/") {
c := appengine.NewContext(r)