Forum Discussion
test for http response header, if not there set one
thanks for your ideer. I have modified it a littel, trying to make it fit my vhost irule like :
switch $vhost { "domain1" { HTTP::version "1.1" HTTP::header remove Server } "domain2" { 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 "" } if !{[HTTP::header exists "Access-Control-Allow-Credentials"]} { HTTP::header insert Access-Control-Allow-Credentials "true" } } }
but I get this error in /var/log/ltm :
warning mcpd[7640]: 01071859:4: Warning generated : /Common/town-multi:518: warning: [use curly braces to avoid double substitution][!{[HTTP::header exists "Access-Control-Allow-Headers"]}] /Common/town-multi:521: warning: [use curly braces to avoid double substitution][!{[HTTP::header exists "Access-Control-Allow-Origin"]}] /Common/town-multi:524: warning: [use curly braces to avoid double substitution][!{[HTTP::header exists "Access-Control-Allow-Credentials"]}]
but it seemes to work....
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