Skip to content

Commit d644289

Browse files
author
Gusted
authored
Backport: Disable content sniffing on PlainTextBytes (#18365)
- Backport of #18359
1 parent fd9ff7c commit d644289

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

modules/context/context.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,7 @@ func (ctx *Context) PlainTextBytes(status int, bs []byte) {
291291
}
292292
ctx.Resp.WriteHeader(status)
293293
ctx.Resp.Header().Set("Content-Type", "text/plain;charset=utf-8")
294+
ctx.Resp.Header().Set("X-Content-Type-Options", "nosniff")
294295
if _, err := ctx.Resp.Write(bs); err != nil {
295296
log.Error("Write bytes failed: %v", err)
296297
}

0 commit comments

Comments
 (0)