Forum Discussion
Michael_108224
Nimbostratus
Sep 05, 2014test for http response header, if not there set one
the senario is, the webserver sometimes "forgot" to set http header. I would like a irule witch first is checking if the http header is ther. If the header is present (dont change). If the header is ...
nitass_89166
Noctilucent
Sep 05, 2014i think exclamation mark (!) should be inside curly brackets.
e.g.
config
[root@ve11a:Active:In Sync] config tmsh list ltm rule qux
ltm rule qux {
when HTTP_RESPONSE {
if { ![HTTP::header exists "Access-Control-Allow-Credentials"] } {
HTTP::header insert "Access-Control-Allow-Credentials" "true"
}
if { ![HTTP::header exists "Access-Control-Allow-Headers"] } {
HTTP::header insert "Access-Control-Allow-Headers" ""
}
if { ![HTTP::header exists "Access-Control-Allow-Origin"] } {
HTTP::header insert "Access-Control-Allow-Origin" ""
}
}
}
test
[root@ve11a:Active:In Sync] config curl -I http://172.28.24.10
HTTP/1.1 200 OK
Date: Fri, 05 Sep 2014 11:06:09 GMT
Server: Apache/2.2.3 (CentOS)
Last-Modified: Sun, 09 Feb 2014 08:39:51 GMT
ETag: "41879c-59-2a9c23c0"
Accept-Ranges: bytes
Content-Length: 89
Content-Type: text/html; charset=UTF-8
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers:
Access-Control-Allow-Origin:
Vitaliy_Savrans
Nacreous
Sep 05, 2014i think exclamation mark (!) should be inside curly brackets.
Thanks that was my mistake
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