Skip to content

Commit c9a2436

Browse files
committed
cmd/godoc: set Strict-Transport-Security header in production
This coerces browsers into enforcing HTTPS-only for golang.org. Change-Id: I91a4cc64b10b9836ef5623314a3cf22a54033dc2 Reviewed-on: https://go-review.googlesource.com/22673 Reviewed-by: Brad Fitzpatrick <[email protected]>
1 parent 0238d42 commit c9a2436

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

cmd/godoc/handlers.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ func (h hostEnforcerHandler) ServeHTTP(w http.ResponseWriter, r *http.Request) {
5454
http.Redirect(w, r, r.URL.String(), http.StatusFound)
5555
return
5656
}
57+
w.Header().Set("Strict-Transport-Security", "max-age=31536000; preload")
5758
h.h.ServeHTTP(w, r)
5859
}
5960

0 commit comments

Comments
 (0)