cancel
Showing results for 
Search instead for 
Did you mean: 

x-content-type-options

vaibhav_salunk2
Nimbostratus
Nimbostratus

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

1 ACCEPTED SOLUTION

Lidev
MVP
MVP

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" } }

REF - https://support.f5.com/csp/article/K04436209

View solution in original post

3 REPLIES 3

Lidev
MVP
MVP

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" } }

REF - https://support.f5.com/csp/article/K04436209

vaibhav_salunk2
Nimbostratus
Nimbostratus

Hi Lidev,

 

Thanks for quick reply, i am new to i-rule syntax, just wanted to understand use ! in syntax.

Lidev
MVP
MVP

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".