cancel
Showing results for 
Search instead for 
Did you mean: 

Modify blank URI

Fready_Ball
Nimbostratus
Nimbostratus

I am using this to modify get request in F5 to real server.

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

HTTP::uri [string map {"/supervisor" "/admin"} [HTTP::uri]]

}

 

and it works OK.

 

but i need to change the get request to /user but only if URI is blank.

 

so abc.com/ will send get abc.com/user

 

 

I have tried this...

 

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

HTTP::uri [string map {"/" "/user"} [HTTP::uri]]

}

 

this kind of works as i see get abc.com/user but it then adds /user to all URI's, so abc.com/admin becomes abc.com/useradmin

 

so i only need to add /user if the URI is blank,

 

any help appreciated as going bonkers...

 

1 ACCEPTED SOLUTION

Hi Fready Ball,

 

You must use equals instead of starts_with.

if { [HTTP::uri] equals "/" } { HTTP::uri [string map {"/" "/user"} [HTTP::uri]] }

 

View solution in original post

3 REPLIES 3

Hi Fready Ball,

 

You must use equals instead of starts_with.

if { [HTTP::uri] equals "/" } { HTTP::uri [string map {"/" "/user"} [HTTP::uri]] }

 

Hi eaa, many thanks for your quick response. I will be testing this morning.

added with elseif and works a treat... thanks again eaa.