mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-05 14:57:49 +00:00
cmd/derper: enable HSTS when serving over HTTPS.
Starting with a short lifetime, to verify nothing breaks. Updates #3373 Signed-off-by: David Anderson <danderson@tailscale.com>
This commit is contained in:
parent
f76a8d93da
commit
937e96f43d
@ -235,6 +235,14 @@ func main() {
|
||||
cert.Certificate = append(cert.Certificate, s.MetaCert())
|
||||
return cert, nil
|
||||
}
|
||||
httpsrv.Handler = http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
// Security scanners get cranky when HTTPS sites don't set
|
||||
// HSTS. Set it even though derper doesn't really serve
|
||||
// anything of interest to browsers (and API clients like
|
||||
// tailscale don't obey HSTS).
|
||||
w.Header().Set("Strict-Transport-Security", "max-age=600; includeSubDomains")
|
||||
mux.ServeHTTP(w, r)
|
||||
})
|
||||
go func() {
|
||||
port80srv := &http.Server{
|
||||
Addr: net.JoinHostPort(listenHost, "80"),
|
||||
|
Loading…
x
Reference in New Issue
Block a user