Forum Discussion
Mike_Maher
Nimbostratus
Aug 29, 2005HTTP: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_12Historic F5 AccountMike,
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 - Mike_Maher
Nimbostratus
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_12Historic F5 AccountGreat news Mike. I'm glad to hear all is working as intended now. Enjoy!
-Colin
Recent Discussions
Related Content
DevCentral Quicklinks
* Getting Started on DevCentral
* Community Guidelines
* Community Terms of Use / EULA
* Community Ranking Explained
* Community Resources
* Contact the DevCentral Team
* Update MFA on account.f5.com
Discover DevCentral Connects
