Forum Discussion
Andrew_Husking
Sep 03, 2013Cirrus
iRule/http profile to change server side host header.
We are using the F5's as a central portal that can be presented anywhere on the network.
What we want to be able to do is go http://portal.company.com/application and have /application go to web...
Kevin_Stewart
Sep 03, 2013Employee
Is this an APM access portal, or just LTM-based? If the latter, you'll probably want to use a data group to map the URI pattern to a given internal host name. Example:
Data group (ex. my_uri_dg):
"/application1" := "server1.domain.com"
"/application2" := "server2.domain.com"
"/application3" := "server3.domain.com"
And then an iRule like this:
when HTTP_REQUEST {
if { [class match [string tolower [HTTP::uri]] starts_with my_uri_dg] } {
HTTP::header replace Host [class match -value [string tolower [HTTP::uri]] starts_with my_uri_dg]
}
}
Alternatively, if it's a small static set of hosts you can hard-code it into the iRule, or if it's a large set of dynamically changing hosts, you could potentially perform a reverse DNS query from the load balanced server IP to get the server's name.
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