Forum Discussion

Livius's avatar
Livius
Icon for Cirrus rankCirrus
Jul 17, 2020

TCL Error on replacing strings

Hi everyone,

 

Trying to understand what might be the issue with replacing content with regsub, getting following error :

 

<HTTP_REQUEST> - ERR_ARG (line 2)    invoked from within "HTTP::uri [regsub "/3dnotification" [HTTP::uri] ""] "

 

I might replace the regsub with other operand doing the same operation.

 

The iRule code is the following :

 

 

   if { not ( [string tolower [HTTP::uri]] starts_with "/socket.io" )} then {

      HTTP::uri [regsub "/3dnotification" [HTTP::uri] ""]

      # need to strip trailing slash on URI otherwise results in 404 for resources...

      HTTP::uri [regsub "\/$" [HTTP::uri] ""]

   } elseif { [string tolower [HTTP::header Upgrade]] contains "websocket" } {

      ONECONNECT::reuse disable

      set oc_reuse_disable 1

   }

   HTTP::header replace "X-Forwarded-ContextPath" "/"

}

 

 

  • Hello Livius.

     

    Does the error raise on each query or just with some of them?

     

    I'm suppecting that some specific URI structure could cause this issue.

    Take into account that someone could create some crafted URI that could cause some kind of injection (intencionally or not).

     

    Could you give us some feedback of which specific URI could cause the issue and which one not?

     

    Regards,

    Dario.