Add headers config, closes #25

This commit is contained in:
Ken-Håvard Lieng 2018-12-20 11:51:31 +01:00
parent 6aaa2b521d
commit 8526805c2f
3 changed files with 9 additions and 0 deletions

View file

@ -323,6 +323,10 @@ func (d *Dispatch) serveIndex(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Strict-Transport-Security", hstsHeader)
}
for k, v := range d.Config().Headers {
w.Header().Set(k, v)
}
if strings.Contains(r.Header.Get("Accept-Encoding"), "gzip") {
w.Header().Set("Content-Encoding", "gzip")
w.Header().Set("Content-Length", indexPageLen)