| // Copyright 2016 The Go Authors. All rights reserved. | |
| // Use of this source code is governed by a BSD-style | |
| // license that can be found in the LICENSE file. | |
| package main | |
| import "net/http" | |
| // hstsHandler wraps an http.HandlerFunc such that it sets the HSTS header. | |
| func hstsHandler(fn http.HandlerFunc) http.Handler { | |
| return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { | |
| w.Header().Set("Strict-Transport-Security", "max-age=31536000; preload") | |
| fn(w, r) | |
| }) | |
| } |