Replacing an Http header parameter name with iRule

Hi, I’m new with iRules,

Due to a customer requirement, we need to replace the name of a header parameter from “x-up-calling-line-id” to “msisdn”. Also, all the requests that come with this parameter arrive exclusively from port 80.I’ve been checking related questions but I still have some doubts.

Anyway, this is the iRule I’ve come up with:

when HTTP_REQUEST {       
    if { [TCP::local_port] == 80}{ 
            if {[HTTP::header exists x-up-calling-line-id]}{  
             HTTP::header insert msisdn [HTTP::header $x-up-calling-line-id]           
             HTTP::header remove x-up-calling-line-id        
       }
     }
   }

Can you please help me check if it is ok? Or is there an easier way to do it? Thank you very much.

Maybe…

when HTTP_REQUEST {

if { [TCP::local_port] == 80 && [HTTP::header exists x-up-calling-line-id] } {

set x-up-calling-line-id [HTTP::header values x-up-calling-line-id]

HTTP::header insert msisdn $x-up-calling-line-id

HTTP::header remove x-up-calling-line-id

}

}

Hi,

if the irule is assigned only to VS on HTTP port, you do not need to filter by local_port…