mirror of https://github.com/hashicorp/consul
fix call order in middleware
parent
957301e092
commit
55c0ece134
|
@ -1,3 +1,3 @@
|
|||
```release-note:security
|
||||
Explicitly set 'Content-Type' header to mitigate XSS vulnerability.
|
||||
Explicitly set 'Content-Type' header to mitigate XSS vulnerability.
|
||||
```
|
|
@ -352,12 +352,13 @@ func withRemoteAddrHandler(next http.Handler) http.Handler {
|
|||
func ensureContentTypeHeader(next http.Handler, logger hclog.Logger) http.Handler {
|
||||
|
||||
return http.HandlerFunc(func(resp http.ResponseWriter, req *http.Request) {
|
||||
next.ServeHTTP(resp, req)
|
||||
|
||||
val := resp.Header().Get(contentTypeHeader)
|
||||
if val == "" {
|
||||
resp.Header().Set(contentTypeHeader, plainContentType)
|
||||
logger.Debug("warning: content-type header not explicitly set.", "request-path", req.URL)
|
||||
}
|
||||
next.ServeHTTP(resp, req)
|
||||
})
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue