diff --git a/website/camweb.go b/website/camweb.go index 89f7aff1d..229312fbb 100644 --- a/website/camweb.go +++ b/website/camweb.go @@ -170,6 +170,15 @@ func (h *gitwebHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) { } } +type noWwwHandler struct { + Handler http.Handler +} + +func (h *noWwwHandler) ServeHTTP(rw http.ResponseWriter, r *http.Request) { + // TODO: strip www. + h.Handler.ServeHTTP(rw, r) +} + func main() { flag.Parse() readTemplates() @@ -208,7 +217,7 @@ func main() { } mux.HandleFunc("/", mainHandler) - if err := http.ListenAndServe(*httpAddr, mux); err != nil { + if err := http.ListenAndServe(*httpAddr, &noWwwHandler{Handler: mux}); err != nil { log.Exitf("ListenAndServe %s: %v", *httpAddr, err) } }