Forum Discussion

Mike_Maher's avatar
Mike_Maher
Icon for Nimbostratus rankNimbostratus
Aug 29, 2005

HTTP:header replace

We are trying to replace a HTTP header that is being sent to a port other than 80 on a web server, and we are trying to change the header so that it is sent out on port 80 to a Traffic Shield. List below is an example of what we are trying to do and the code we currently have. Any suggestions.

 

 

wwwmysite.com:2000 to yoursite2000.com (which would just be 80)

 

wwwmysite.com:2001 to yoursite2001.com

 

 

 

 

when HTTP_REQUEST {

 

set names [HTTP::header names]

 

log $names

 

set my_port [TCP::local_port]

 

set my_host [string tolower [HTTP::host]]

 

set host_port $my_host

 

set matchedhost [findclass $host_port $::hostclass =]

 

if { $matchedhost ne ""} {

 

set new_host $matchedhost

 

HTTP::header replace "Host" $new_host}

 

log [HTTP::host]

 

}

3 Replies

  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Mike,

     

     

    Looking at your code it appears as though you're referencing a class of information. What does that class look like?

     

     

    It looks like you've got the general idea, provided the class contained the host that would be incoming, and what you wanted to change it to.

     

     

    How is it behaving now? What's showing up in your log files?

     

     

    -Colin
  • Colin,

     

    Thanks for the reply, we have gotten it sorted out. We had something set wrong in the Pool configuration on the BigIP. The gentleman who helped us set this up didn't show us all the settings. We found it though and it is working great now.
  • Colin_Walker_12's avatar
    Colin_Walker_12
    Historic F5 Account
    Great news Mike. I'm glad to hear all is working as intended now. Enjoy!

     

     

    -Colin