Forum Discussion
Dunleap_21354
Nimbostratus
Mar 28, 2008Rewriting HTTP host name
I'm trying to write my first irule. I need to take the client request:
when HTTP_REQUEST {
and replace the HTTP host name H23.abc.com with D2.xyz.com and pass it on to the pool.
HTTP:header replace Location [string map - nocase (H23.abc.com D2.xyz.com) [HTTP::header value Location]]"
I found the above as part of an example. However I'm not sure I understand the meaning of all of the syntax.
Shouldn't there be a value after HTTP:header indicating which part of the header you want and assign it to some type of tag?
[HTTP:header host == ihostname]
or does the string map part just parse through and replace the string match with the second string.
- If you want to replace the host value (http://host/uri), then you won't want the Location header. The Location header is a response header that used for 301 and 302 based redirects. You'll want to use the basic "Host" header. This should work for you.
when HTTP_REQUEST { if { [HTTP::host] equals "H23.abc.com" } { HTTP::header replace "Host" "D2.xyz.com" } }
- Dunleap_21354
Nimbostratus
Joe
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