Add HTTP header support for the dev server

Fixes #7031
This commit is contained in:
Bjørn Erik Pedersen 2020-03-08 16:33:15 +01:00
parent 51e178a6a2
commit 108314444b
4 changed files with 92 additions and 1 deletions

View file

@ -355,6 +355,10 @@ func (f *fileServer) createEndpoint(i int) (*http.ServeMux, string, string, erro
w.Header().Set("Pragma", "no-cache")
}
for _, header := range f.c.serverConfig.Match(r.RequestURI) {
w.Header().Set(header.Key, header.Value)
}
if f.c.fastRenderMode && f.c.buildErr == nil {
p := r.RequestURI
if strings.HasSuffix(p, "/") || strings.HasSuffix(p, "html") || strings.HasSuffix(p, "htm") {