Forum Discussion

GBurch's avatar
GBurch
Icon for Altostratus rankAltostratus
Dec 05, 2018

iRule Encode special charaters in URI String

I have an iRule, which is capturing the current URI, and appending it as a variable onto another URL string later on.

 

when HTTP_REQUEST {
    ...
    ...
    set host [HTTP::host]
    set uri [HTTP::uri]
    set url "http://internal-address.local.lan/index.html?aup-key=$aupkey&$schema&$host&$uri"
}

However, if the original URI contains an ampersand itself, it's truncating it at that character so that the full original URI never gets passed on.

 

I'm not overly familiar with TCL, is there an easy way I could encode the uri variable in my code above so that it includes all special characters as well?

 

Many thanks