From 59aa5f089f2d2df4d9b6888c0e3d1554b05c82b6 Mon Sep 17 00:00:00 2001 From: "Hayden A. James" Date: Fri, 23 Dec 2016 18:27:53 -0500 Subject: [PATCH] Use 307 response code for redirects on requests other than GET and HEAD for SSL --- secure.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/secure.go b/secure.go index 6843663..e90f4cb 100644 --- a/secure.go +++ b/secure.go @@ -138,7 +138,11 @@ func applySSL(opt Options, res http.ResponseWriter, req *http.Request) { url.Host = opt.SSLHost } - http.Redirect(res, req, url.String(), http.StatusMovedPermanently) + if req.Method != "" && req.Method != "GET" && req.Method != "HEAD" { + http.Redirect(res, req, url.String(), http.StatusTemporaryRedirect) + } else { + http.Redirect(res, req, url.String(), http.StatusMovedPermanently) + } } } }