Add HSTS header

This commit is contained in:
Fijxu 2024-12-11 13:53:06 -03:00
parent d225323628
commit 802dd65edf
Signed by: Fijxu
GPG key ID: 32C1DDF333EDA6A4

View file

@ -242,8 +242,8 @@ func root(w http.ResponseWriter, req *http.Request) {
const msg = ` const msg = `
HTTP youtube proxy for https://inv.nadeko.net HTTP youtube proxy for https://inv.nadeko.net
https://git.nadeko.net/Fijxu/http3-ytproxy https://git.nadeko.net/Fijxu/http3-ytproxy
Routes: Routes:
/stats /stats
/health` /health`
io.WriteString(w, msg) io.WriteString(w, msg)
@ -336,6 +336,7 @@ func beforeProxy(next http.HandlerFunc) http.HandlerFunc {
w.Header().Set("Access-Control-Allow-Headers", "*") w.Header().Set("Access-Control-Allow-Headers", "*")
w.Header().Set("Access-Control-Allow-Methods", "GET, HEAD, OPTIONS") w.Header().Set("Access-Control-Allow-Methods", "GET, HEAD, OPTIONS")
w.Header().Set("Access-Control-Max-Age", "1728000") w.Header().Set("Access-Control-Max-Age", "1728000")
w.Header().Set("Strict-Transport-Security", "max-age=86400")
// } else { // } else {
// w.WriteHeader(401) // w.WriteHeader(401)
// io.WriteString(w, "Only requests coming from inv.nadeko.net are allowed.") // io.WriteString(w, "Only requests coming from inv.nadeko.net are allowed.")