Forum Discussion
Roflcopter
Nimbostratus
Feb 12, 2018Content-Security-Policy
I am trying to construct and iRule that will put a variable into a HTTP Header.
The requirements are -
When a client connects set their HTTP:host as a variable for later use Check that the HTTP...
oguzy_191375
Nimbostratus
Feb 12, 2018Hi,
The code stated below may work. Can you try it?
when CLIENT_ACCEPTED {
set host_exist 0
}
when HTTP_REQUEST {
set host [HTTP::host]
if { [class match $host contains host_lookup_table] } {
set host_exist 1
}
}
when HTTP_RESPONSE {
if { $host_exist equals 1 } {
HTTP::header insert "X-Content-Security-Policy" "frame-ancestors 'self' $host"
HTTP::header insert "X-Content-Security-Policy" "frame-scr 'self' '$host'"
}
else {
HTTP::header insert "X-Content-Security-Policy" "frame-ancestors 'self'"
HTTP::header insert "X-Content-Security-Policy" "frame-scr 'self'"
}
}oguzy_191375
Nimbostratus
Feb 12, 2018You are welcome. I hope it can solve your issue. After your test run tomorrow, if it works, would you mind accepting the answer?
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects