Forum Discussion
bob_rao_7722
Apr 04, 2006Historic F5 Account
host header
I have a server that is listening as a web server on a virtual host. So when I go to my web browser and type: "images.testme.com" I go to the web site I created on that server. I have two servers set up like this.
Now I want to front end this with a bigip and use a VIP – but I can not seem to get the host name insert part working using irules I have written.
What iRule command would I use to insert this host name?
I assume it is:
HTTP::header insert
bob
- Colin_Walker_12Historic F5 AccountWell, depending on what it is you're actually trying to do, then yes, you could use the HTTP::header insert command.
when HTTP_REQUEST { HTTP::header insert X-yourcustomheader "value" }
- bob_rao_7722Historic F5 Account
- bob_rao_7722Historic F5 AccountThe servers listen for the web site – using host headers.
- Just use the HTTP::header replace command to replace the "Host" header value.
when HTTP_REQUEST { HTTP::header replace "Host" "images.dev.testme.com" }
- Shawn_Badger_11
Nimbostratus
class myIPRelations { - Deb_Allen_18Historic F5 AccountLet me try to re-state the problem description as I understand it:
class hostTranslations { "images.test.com images.dev.test.com" "site1.test.com site1.dev.test.com" "site2.test.com site2.dev.test.com" } rule hostTranslations_with_lookup { when HTTP_REQUEST { set newHost [findclass [HTTP::host] $::hostTranslations " "] if { [info exists $newHost] } { HTTP::header replace Host $newHost } } }
rule hostTranslations_simpler { when HTTP_REQUEST { HTTP::header replace Host [getfield [HTTP::host] "." 1].[getfield [HTTP::host] "." 3].[getfield [HTTP::host] "." 4] } }
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