Forum Discussion

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

Please explain set uri line below irule & entire irule



   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

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

    Incomming Request:


    Forwarded Request:


    Cheers, Kai