iRule for CORS OPTIONS Header
I am working on creating an iRule that sends a 200 response when an OPTIONS header is sent. Here is the rule:
when HTTP_REQUEST {
if { ( [HTTP::method] equals "OPTIONS" ) } {
HTTP::respond 200 Access-Control-Allow-Origin "[HTTP::header Origin]"
Access-Control-Allow-Methods "POST, GET, OPTIONS"
Access-Control-Allow-Headers "[HTTP::header Access-Control-Request-Headers]"
Access-Control-Max-Age "86400"
return
}
}
When attempting to deploy this irule to an application, I am given the following error:
IRule error: Transaction on BIG-IP failed after 0 seconds: 01070151:3: Rule [/Common/CORS-Preflight] error: /Common/CORS-Preflight:4: error: [undefined procedure: Access-Control-Allow-Methods][Access-Control-Allow-Methods "POST, GET, OPTIONS"] /Common/CORS-Preflight:5: error: [undefined procedure: Access-Control-Allow-Headers][Access-Control-Allow-Headers "[HTTP::header Access-Control-Request-Headers]" ] /Common/CORS-Preflight:6: error: [undefined procedure: Access-Control-Max-Age][Access-Control-Max-Age "86400"]
Can anyone help with what the syntax issue may be with this?