iRule to insert cookie when there is external site cookie on the APM
Hi,all
I've created a iRule such as the following.
- Check wheter there is "SMSESSION" Cookie.
- If there is "SMSESSION" Cookie, Insert the same Cookie at the time of the Portal Access.
It was successful in the insert of Cookie, but an error such as the following appeared on the /var/log/ltm.
Oct 24 16:38:36 ra-bip2000s-test err tmm[9529]: 01220001:3: TCL error: /Common/a_sap - Illegal argument. Can't execute in the current context. (line 1) invoked from within "HTTP::header insert "Cookie" "SMSESSION=$ca_auth""
Please verify the below irule and advise me for any modification.
when CLIENT_ACCEPTED {
ACCESS::restrict_irule_events disable
}
when HTTP_REQUEST {
if { ( [HTTP::cookie exists SMSESSION] ) } {
set ca_auth [findstr [HTTP::header cookie] "SMSESSION=" "10" ";"]
set ca_flag 1
} else {
set ca_flag 0
}
}
when REWRITE_REQUEST_DONE {
if { $ca_flag == 1 } {
HTTP::header insert "Cookie" "SMSESSION=$ca_auth"}}
Regards,