Forum Discussion
Rewrite host header to specific pool member
I've done basic host header rewrites rules in the past but I've just received an odd request that's beyond me. I'm scrapping together a solution from multiple posts but haven't got anything to pass yet.
Our developers want the F5 to receive the URL "ims.services.company.com" and rewrite the host header to reflect the specific pool member, after the node is selected by the LB algorithm. To the point, they want the client to send the GET with "ims.services.company.com" in the host header and the F5, serverside, to send a GET for "ims.services..company.com" in the header.
I've tried this with combinations of HTTP_REQUEST, LB_SELECTED, and HTTP_REQUEST_SEND but nothings working.
I'm assuming this can be done?
Thanks.
- suprgroovy_1658
Nimbostratus
I am picking up this project from Andy, and have had to reverse-engineer this irule back into our QA environment (runs the same version of code), and of course, it doesnt work there. I created the data class with the same name and syntax, just with the new IP addresses and string to lookup. the debug logs showthis: - hoolio
Cirrostratus
Hi Clay, - suprgroovy_1658
Nimbostratus
just to be sure, i went back and deleted/retyped those characters, and I get the same message in the ltm log: - suprgroovy_1658
Nimbostratus
Not sure what the problem was, but here is how i fixed it: - hoolio
Cirrostratus
That's quite odd. Glad you got it working regardless. - w7com_208168
Nimbostratus
Here's how I pulled it off:
when LB_SELECTED { set POOL [LB::server addr] log local0.debug "Pool Member is $POOL" switch $POOL { 10.65.16.135 { HTTP::header replace Host "strv-int2.corp.lan" } 10.65.17.62 { HTTP::header replace Host "strv-int4.corp.lan" } default { log local0.debug "Default hit on STRV-rewrite." } } }
Recent Discussions
Related Content
* 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