Forum Discussion

BB16's avatar
BB16
Icon for Nimbostratus rankNimbostratus
Jan 29, 2018

Please explain set uri line below irule & entire irule

co_d10_xyz

"/pqrs/xyz/*"

{
   HTTP::header insert X-Forwarded-For [IP::remote_addr]       
   set uri [string map -nocase {"pqrs/xyz" "pqrs"} [HTTP::uri]]                    
   HTTP::uri $uri                   
   pool kt_dev_xyz
}

Have a close look for pqrs & xyz, thank you

1 Reply

  • Hi bbukane,

    to explain your entire iRule you need at least post the entire iRule... 😉

    set uri [string map -nocase {"pqrs/xyz" "pqrs"} [HTTP::uri]]                    
    HTTP::uri $uri 
    

    The iRule snipped above will read the currently requested HTTP::uri (e.g. /pqrs/xyz/file.html) and replace any ocourence of the string "pqrs/xyz" with "pqrs" while ignoring possible upper/lower cases for the search pattern. It will then temporary store the result of the replacement into the variable

    $uri
    and then overwrite the currently requested
    HTTP::uri
    with the just computed value of
    $uri
    before forwarding the request to the backend server.

    Incomming Request:

    http://sitename/pqrs/xyz/file1.html

    Forwarded Request:

    http://sitename/pqrs/file1.html

    Cheers, Kai