How do I add X-Content-Type-Options: nosniff to files served by Fastly?


We generally serve files with X-Content-Type-Options: nosniff to prevent IE from doing something inappropriate (and possibly exploitable) with the content.

However we noticed our Fastly CDN served files do not have this header.

How can we add this header?


OK I found this

And I think this is correct?

Type: Response, Set
Destination: http.X-Content-Type-Options
Source: “nosniff”

Anyway, the goal is to get this header set in responses:

X-Content-Type-Options: nosniff


Yes, that is correct.


Thanks! I can confirm that I now see the proper header via curl -I so this seems correct!



Just as a note when you check for the headers, you’ll want to stay away from curl -I, as that’s a Head request. On Head requests, we don’t cluster, and when we don’t cluster, the cache nodes act individually. As a result, you may see intermittent behavior. Instead, we recommend you use curl -svo /dev/null <url>.