diff options
Diffstat (limited to 'cmd/http/main.go')
-rw-r--r-- | cmd/http/main.go | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/cmd/http/main.go b/cmd/http/main.go index a75ccfc..951c02f 100644 --- a/cmd/http/main.go +++ b/cmd/http/main.go @@ -18,7 +18,7 @@ type application struct { infoLog *log.Logger } -func (app *application) httpsRedirect(w http.ResponseWriter, req *http.Request) { +/*func (app *application) httpsRedirect(w http.ResponseWriter, req *http.Request) { // remove/add not default ports from req.Host target := "https://" + req.Host + req.URL.Path if len(req.URL.RawQuery) > 0 { @@ -28,12 +28,12 @@ func (app *application) httpsRedirect(w http.ResponseWriter, req *http.Request) http.Redirect(w, req, target, // see comments below and consider the codes 308, 302, or 301 http.StatusMovedPermanently) -} +}*/ func (app *application) wwwRedirect(h http.Handler) http.Handler { return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { if !strings.HasPrefix(r.Host, "www.") { - http.Redirect(w, r, "https://www."+r.Host+r.RequestURI, 302) + http.Redirect(w, r, "https://www."+r.Host+r.RequestURI, http.StatusFound) return } @@ -66,8 +66,10 @@ func main() { mux.HandleFunc("/gallery/", app.page) mux.HandleFunc("/links", app.page) mux.HandleFunc("/links/", app.page) - mux.HandleFunc("/blog", app.page) - mux.HandleFunc("/blog/", app.page) + mux.HandleFunc("/blog", app.blog) + mux.HandleFunc("/blog/", app.blog) + mux.HandleFunc("/archive", app.archive) + mux.HandleFunc("/archive/", app.archive) mux.HandleFunc("/", app.home) if *addr == ":443" { |