Forum Discussion

Jnon's avatar
Jnon
Icon for Nimbostratus rankNimbostratus
Dec 06, 2017

Manipulating uri string and host

I have the following iRule, I could use a little assistance with:

 

when HTTP_REQUEST { set var1 [getfield [HTTP::uri] "/" 2 ] set var2 [getfield [HTTP::uri] "/" 3 ] HTTP::host "$var2.$var1.[HTTP::host]" log local0. "[HTTP::host]" HTTP::uri [substr [HTTP::uri] [expr ([string length $var1$var2 ] + 1)]] log local0. "Host and URI modified to: [HTTP::host][HTTP::uri]" }

 

I'm trying to remove var1 and var2 from the uri string and shift the string left the number or characters that are consistent with var1/Var2/ - when trying to manipulating the uri, I get an error wrong args [ string length $var1 $var2 ]

 

I tried to put var1 and var2 into one variable and that received error as well, I have it working for a single variable, but when I introduce the second variable I have problems.

 

1 Reply

  • Jnon's avatar
    Jnon
    Icon for Nimbostratus rankNimbostratus

    I realized in my actual rule, I had a space between $var1$var2 which as causing the problem, I took the space out and wrote it like I had it in question above, and it worked fine.