tcl error CORS3_irule

Need some help. I get a tcl error /common/CORS3_irule - operation not supported invoked from within “HTTP::header insert Access-Control-Allow-Origin *”. But i can’t find any wrong in my irule.

My irule is as below. when HTTP_RESPONSE { HTTP::header insert Access-Control-Allow-Origin * HTTP::header insert Access-Control-Allow-Credentials true

HTTP::header insert Access-Control-Allow-Headers “Origin,Content-Type,Accept,Cache-Control,Pragma,Options,If-Modified-Since” HTTP::header insert Access-Control-Allow-Methods “GET,PUT,POST,DELETE”} when HTTP_REQUEST { HTTP::header insert Access-Control-Allow-Origin * HTTP::header insert Access-Control-Allow-Credentials true

HTTP::header insert Access-Control-Allow-Headers “Origin,Content-Type,Accept,Cache-Control,Pragma,Options,If-Modified-Since” HTTP::header insert Access-Control-Allow-Methods “GET,PUT,POST,DELETE”}

Do you have any other irules that trigger a redirect assigned to the virtual.

Once a redirect is triggered, you cannot modify the request in a subsequent irule.