aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorclsr <clsr@clsr.net>2016-06-18 17:57:14 +0200
committerclsr <clsr@clsr.net>2016-06-18 17:57:14 +0200
commitc11e3df0cca9239c07d2738038065860e8d942a0 (patch)
tree336dfe559714f437039f82c8beee1ea6064b1fe2
parenta58ca2fe51afe945b241bcab4fb21b0d4a9fcbe4 (diff)
downloadgomf-c11e3df0cca9239c07d2738038065860e8d942a0.tar.gz
gomf-c11e3df0cca9239c07d2738038065860e8d942a0.zip
Do not redirect to HTTPS with when the Host header is blank
-rw-r--r--main.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/main.go b/main.go
index 2dcac62..6e4b0f6 100644
--- a/main.go
+++ b/main.go
@@ -31,7 +31,7 @@ func handle(w http.ResponseWriter, r *http.Request) {
if hsts {
w.Header().Set("Strict-Transport-Security", "max-age=15552000")
}
- if redirectHttps && r.TLS == nil {
+ if redirectHttps && r.TLS == nil && r.Host != "" {
targ := &*r.URL
targ.Host = r.Host
targ.Scheme = "https"