Forum Discussion
x-content-type-options
Hi,
I want to insert X-Content-Type-Options value as nosniff in http header using i-rule and below is my syntax.
when HTTP_RESPONSE {
if { [HTTP::header exists "X-Content-Type-Options"]} {
HTTP::header insert "X-Content-Type-Options" "nosniff"
}
}
Please confirm if it is correct or not
Hello,
Here is the correct syntax
when HTTP_RESPONSE_RELEASE { if {!([HTTP::header exists "X-Content-Type-Options"])} { HTTP::header insert "X-Content-Type-Options" "nosniff" } }
3 Replies
- Lidev
Nacreous
Hello,
Here is the correct syntax
when HTTP_RESPONSE_RELEASE { if {!([HTTP::header exists "X-Content-Type-Options"])} { HTTP::header insert "X-Content-Type-Options" "nosniff" } } - vaibhav_salunk2
Nimbostratus
Hi Lidev,
Thanks for quick reply, i am new to i-rule syntax, just wanted to understand use ! in syntax.
- Lidev
Nacreous
You're welcome.
if you want to go deeper, read this great documentation to know everything about iRules 😉
https://devcentral.f5.com/s/articles/irules-101-01-introduction-to-irules
If my answer was helpful, don't forget to mark the answer as "the best".
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
