For more information regarding the security incident at F5, the actions we are taking to address it, and our ongoing efforts to protect our customers, click here.

Forum Discussion

jwlarger's avatar
jwlarger
Icon for Cirrus rankCirrus
Nov 06, 2019
Solved

iRule to replace { - } with %7B - %7D

I need to parse incoming headers and selectively replace { or } with %7B or %7D.

(v11.6.3)

 

Something like ?

when HTTP_REQUEST {

  if { [HTTP::uri] starts_with "/someuri/" } {

    HTTP::uri [string map {"/{/" "/%7B/"} [HTTP::uri]]

  }

}

 

But I suspect I'm not escaping the { character correctly.

01070151:3: Rule [/Common/test] error: /Common/test:3: error: [parse error: missing close-bracket][[string map {"/{/" "/%7B/"} [HTTP::uri]]

}]

 

TIA

  • Hi,

    You must escape this with back slash.

    HTTP::uri [string map {\{ %7B \} %7D} [HTTP::uri]]
     
    OR
     
    HTTP::uri [string map {\x7B %7B \x7D %7D} [HTTP::uri]]

    I hope it helps.

    Regards.

2 Replies

  • Hi,

    You must escape this with back slash.

    HTTP::uri [string map {\{ %7B \} %7D} [HTTP::uri]]
     
    OR
     
    HTTP::uri [string map {\x7B %7B \x7D %7D} [HTTP::uri]]

    I hope it helps.

    Regards.