Forum Discussion

Chris_Hotchkiss's avatar
Chris_Hotchkiss
Icon for Nimbostratus rankNimbostratus
Oct 27, 2015

iRule snippet insertion 11.5.1

Long story short I have an irule to insert some snippets in the HTTP response but instead of inserting the contents of the variables, it is just using the actual string text. The log output shows $y and $stream_expression values as @$head_token@$detection_snippet@ instead of the contents of those variables which check out fine in section 4. Section 5 is the problem area. Any advice would be much appreciated.

Section 3: Identify Location Tokens
set head_token ""
End of section 3 Section 4: Identify Snippet iFiles
set detection_snippet "[subst -nocommands -nobackslashes [ifile get Test_locdrive_js]]$head_token" 
set collection_snippet "[subst -nocommands -nobackslashes [ifile get Test_exout_js]]$head_token" 
    set session_rst_snippet "[subst -nocommands -nobackslashes [ifile get Test_sessionrst_js]]$head_token"
    set uid_collect_snippet "[subst -nocommands -nobackslashes [ifile get Test_setdata_js]]$head_token"
    set perm_uid_snippet "[subst -nocommands -nobackslashes [ifile get Test_runvar_js]]$head_token"
    log local0. "Trusteer-assign snippet variables"
    log local0. "$head_token"
    log local0. "$detection_snippet"
    log local0. "$uri(1)"
End of section 4 Section 5: Modify URL and Snippet Array
array set snippet_insertion { 
"[subst $uri(1)]" @$head_token@$detection_snippet@
"[subst $uri(2)]" @$head_token@$uid_collect_snippet@@$head_token@$perm_uid_snippet@

}

End of section 5 Do Not Modify
       foreach {x y} [array get snippet_insertion] { 
        if {$loc == "[subst $x]"} {
                        log local0. "$x"
                        log local0. "$loc"
                        log local0. "$y"
        set stream_expression $y
                        log local0. "$stream_expression"
            STREAM::expression [subst $stream_expression] 
            STREAM::enable
                        log local0. "Trusteer enabling stream" 
    } 
    } 
  }
  }
End of 'Do Not Modify' Section End of iRule
  • Here is the full HTTP_Response portion:

    when HTTP_RESPONSE { if {$action == 1} { STREAM::disable if {$SIdManagement == 1 && $isSet == 0} { HTTP::cookie insert name "$idCookie" value "$sessId" domain "$cookieDomain" log local0. "Trusteer $idCookie" }

    End of 'Do Not Modify' Section Section 3: Identify Location Tokens
    set head_token ""
    
    set _token "" set _token "" End of section 3 Section 4: Identify Snippet iFiles
    set detection_snippet "[subst -nocommands -nobackslashes [ifile get Test_locdrive_js]]$head_token" 
    set collection_snippet "[subst -nocommands -nobackslashes [ifile get Test_exout_js]]$head_token" 
        set session_rst_snippet "[subst -nocommands -nobackslashes [ifile get Test_sessionrst_js]]$head_token"
        set uid_collect_snippet "[subst -nocommands -nobackslashes [ifile get Test_setdata_js]]$head_token"
        set perm_uid_snippet "[subst -nocommands -nobackslashes [ifile get Test_runvar_js]]$head_token"
        log local0. "Trusteer-assign snippet variables"
        log local0. "$head_token"
        log local0. "$detection_snippet"
        log local0. "$uri(1)"
    
    End of section 4 Section 5: Modify URL and Snippet Array
    array set snippet_insertion { 
    "[subst $uri(1)]" @$head_token@$session_rst_snippet@@$head_token@$detection_snippet@@$head_token@$collection_snippet@
    "[subst $uri(2)]" @$head_token@$uid_collect_snippet@@$head_token@$perm_uid_snippet@
    

    }

    End of section 5 Do Not Modify
           foreach {x y} [array get snippet_insertion] { 
            if {$loc == "[subst $x]"} {
                   log local0. "$x"
                   log local0. "$loc"
                   log local0. "$y"
            set stream_expression $y
                   log local0. "$stream_expression"
            STREAM::expression [subst $stream_expression] 
            STREAM::enable
                   log local0. "Trusteer enabling stream" 
        } 
        } 
      }
      }
    
    End of 'Do Not Modify' Section End of iRule

    and here is the log of responses that will correlate:

    Oct 28 11:12:45 jn-bigip2 info tmm3[11592]: Rule /Common/trusteer_pinpoint_mod : Trusteer idstick Oct 28 11:12:45 jn-bigip2 info tmm3[11592]: Rule /Common/trusteer_pinpoint_mod : Trusteer-assign snippet variables Oct 28 11:12:45 jn-bigip2 info tmm3[11592]: Rule /Common/trusteer_pinpoint_mod : Oct 28 11:12:45 jn-bigip2 info tmm3[11592]: Rule /Common/trusteer_pinpoint_mod : Oct 28 11:12:45 jn-bigip2 info tmm3[11592]: Rule /Common/trusteer_pinpoint_mod : /wcmfd/wcmpw/CustomerLogin Oct 28 11:12:45 jn-bigip2 info tmm3[11592]: Rule /Common/trusteer_pinpoint_mod : [subst $uri(1)] Oct 28 11:12:45 jn-bigip2 info tmm3[11592]: Rule /Common/trusteer_pinpoint_mod : /wcmfd/wcmpw/CustomerLogin Oct 28 11:12:45 jn-bigip2 info tmm3[11592]: Rule /Common/trusteer_pinpoint_mod : @$head_token@$session_rst_snippet@@$head_token@$detection_snippet@@$head_token@$collection_snippet@ Oct 28 11:12:45 jn-bigip2 info tmm3[11592]: Rule /Common/trusteer_pinpoint_mod : @$head_token@$session_rst_snippet@@$head_token@$detection_snippet@@$head_token@$collection_snippet@ Oct 28 11:12:45 jn-bigip2 info tmm3[11592]: Rule /Common/trusteer_pinpoint_mod : Trusteer enabling stream