Forum Discussion
bigipjr28_13978
Nimbostratus
Jan 22, 2016irule that clears and then sets header for multiple vips
Hey Guy,
looking for an iRule that clears and sets the HTTP Host header to the appropriate value for all VIPs on LTM.
Here is what I was thinking below:
when HTTP_REQUEST {
...
Kai_Wilke
MVP
Jan 26, 2016Hi bigipjr28,
a sample code would look like this...
when HTTP_REQUEST {
if { [set temp(virtual) [URI::basename [virtual name]]] starts_with "DC_" } then {
if { [set temp(host) [class match -value $temp(virtual) equals DG_VIRTUAL_2_HOST]] ne "" } then {
HTTP::header remove Host
HTTP::header insert Host $temp(host)
} else {
The Datagroup doesn't have a match.
Add additional code here to handle those exeptions or simply let the requests pass.
}
} else {
HTTP::header remove Host
HTTP::header insert Host $temp(virtual)
}
unset -nocomplain temp
}
Note: I haven't had the chance to test the actual code. So please bear with me if minor syntax errors (e.g. missing braces, etc.) are left... 😉
Cheers, Kai
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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