0
Fork 0
mirror of https://github.com/willnorris/imageproxy.git synced 2024-12-16 21:56:43 -05:00

Add X-XSS-Protection HTTP response header to block potential XSS

This commit is contained in:
Yassine ABOUKIR 2021-01-22 19:05:12 +01:00 committed by Will Norris
parent dd798db002
commit 2203979b9c

View file

@ -257,6 +257,9 @@ func (p *Proxy) serveImage(w http.ResponseWriter, r *http.Request) {
// Disable Content-Type sniffing
w.Header().Set("X-Content-Type-Options", "nosniff")
// Block potential XSS attacks especially in legacy browsers which do not support CSP
w.Header().Set("X-XSS-Protection", "1; mode=block")
w.WriteHeader(resp.StatusCode)
if _, err := io.Copy(w, resp.Body); err != nil {