mirror of
https://github.com/AdguardTeam/AdGuardHome.git
synced 2024-11-22 04:55:33 +03:00
changes done based on review
1. set only `h3` header 2. set default max-age 3. support https redirect as well
This commit is contained in:
parent
b7e815483e
commit
0c0340d63e
1 changed files with 10 additions and 5 deletions
|
@ -320,6 +320,16 @@ func handleHTTPSRedirect(w http.ResponseWriter, r *http.Request) (ok bool) {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Let the browser know that server support HTTP/3
|
||||||
|
// max-age is set to default (24 hourd)
|
||||||
|
//
|
||||||
|
// See https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Alt-Svc
|
||||||
|
// TODO: take max-age from config and set
|
||||||
|
if config.DNS.ServeHTTP3 {
|
||||||
|
altSvc := fmt.Sprintf(`h3=":%[1]v";`, config.TLS.PortHTTPS)
|
||||||
|
w.Header().Set("Alt-Svc", altSvc)
|
||||||
|
}
|
||||||
|
|
||||||
if r.TLS == nil && web.forceHTTPS {
|
if r.TLS == nil && web.forceHTTPS {
|
||||||
hostPort := host
|
hostPort := host
|
||||||
if port := web.conf.PortHTTPS; port != defaultPortHTTPS {
|
if port := web.conf.PortHTTPS; port != defaultPortHTTPS {
|
||||||
|
@ -347,11 +357,6 @@ func handleHTTPSRedirect(w http.ResponseWriter, r *http.Request) (ok bool) {
|
||||||
Host: r.Host,
|
Host: r.Host,
|
||||||
}
|
}
|
||||||
|
|
||||||
if config.DNS.ServeHTTP3 {
|
|
||||||
altSvc := fmt.Sprintf(`h3=":%[1]v"; ma=2592000,h3-29=":%[1]v"; ma=2592000,h3-Q050=":%[1]v";ma=2592000,h3-Q046=":%[1]v"; ma=2592000,h3-Q043=":%[1]v"; ma=2592000,quic=":%[1]v"; ma=2592000; v="46,43"`, config.TLS.PortHTTPS)
|
|
||||||
w.Header().Set("Alt-Svc", altSvc)
|
|
||||||
}
|
|
||||||
|
|
||||||
w.Header().Set("Access-Control-Allow-Origin", originURL.String())
|
w.Header().Set("Access-Control-Allow-Origin", originURL.String())
|
||||||
w.Header().Set("Vary", "Origin")
|
w.Header().Set("Vary", "Origin")
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue