Forum Discussion
Julian_Grunnell
Nimbostratus
Jul 24, 2008Rewriting HOST header
Hi - can someone offer some help, I've got a request to do some header rewriting and have a rough idea of how to do this but hoping someone has done this before!!
I need to have an iRule that takes a request such as www.site1.com and sends to the www_pool and requests for admin.site1.com goto the admin_pool. Now this is pretty straightforward BUT is there a way that once I've determined that the request is for a host that starts with "admin" I can rewrite the host header to www.site1.com for example and STILL send to the admin_pool?
Also the number of unique sites is around 160 at present with more being adding, around 10 a month.
Thanks in advance - Julian.
- Nicolas_Menant
Employee
Hi,HTTP::header replace Host www.site1.com
- Julian_Grunnell
Nimbostratus
Hi - thanks, should have said as well I see that will work but when I have 160 sites to start with and more being added is there a better way to do this? I don't fancy having 160+ replace statements. - Nicolas_Menant
Employee
Hi,class dest_pairs { " proxy" "admin.site1.com www.mysite.com" "admin.site2.com www.mysite2.com" } when CLIENT_ACCEPTED { set my_dest [findclass [HTTP::host] $::dest_pairs " "] if { $my_destl ne "" } { HTTP::header replace Host $my_dest } }
- Julian_Grunnell
Nimbostratus
Thanks again - not thought about using a class!! LTM is running v9.1.2 ... needs upgrading as well. - Colin_Walker_12Historic F5 AccountA class or a switch are definitely the cleanest way to achieve this. A class is easiest for updating on a more regular basis, a switch is a little bit faster if you're going to be setting this once and leaving it alone.
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