Forum Discussion
kking_154659
Nimbostratus
Nov 09, 2015trying to set a response header based on the referer
irule newby trying to set a response header based on the referer but getting the error below.
when HTTP_REQUEST {
set referer_host [URI::host [HTTP::header value Referer]]
when HTTP_RESP...
Brad_Parker_139
Nacreous
Nov 09, 2015ne and then are not valid TCL commands. Also, there's no need to check if the variable is an empty string if you are looking for an explicit string. Give this a try:
when HTTP_REQUEST {
set referer_host [URI::host [HTTP::header value Referer]]
}
when HTTP_RESPONSE {
if {$referer_host contains "lbl.gov"}{
HTTP::header insert X-Frame-Options "ALLOW-FROM $referer_host"
}
else {
HTTP::header insert X-Frame-Options "SAMEORIGIN"
}
}
kking_154659
Nimbostratus
Nov 09, 2015thanks much
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