Forum Discussion
Joe_Pawlicki_70
Nimbostratus
Jul 21, 2008Rewriting HTTP::host
At the risk of looking like a newbie, is this supposed to work?:
when HTTP_REQUEST {
HTTP::host "foo.bar.com"
HTTP::uri "/some_uri"
}
Darned if I can get it to work, at least on v9.3.1:
BIGpipe: rule modification error:
01070151:3: Rule [my_rewrite] error:
line 2: [wrong args] [HTTP::host "foo.bar.com"]
I see lots of examples of rewriting HTTP::uri, or redirecting via a 302, but don't see any mechanism to directly rewrite the destination host.domain.
What am I missing? Thx.
- Nicolas_Menant
Employee
Hi,HTTP::header replace "Host" foo.bar.com
- My bad on that one. Sorry about the bad suggestion. For the host header, you'll need to use the "HTTP::header replace" command as suggested here.
- Joe_Pawlicki_70
Nimbostratus
...which rewrites the header, but doesn't actually send the request to foo.bar.com, right? I still need a pool with one or more hard-coded ip addresses. - Nicolas_Menant
Employee
Yes the command will only replace the HTTP header but will not route this request to this new domain - Joe_Pawlicki_70
Nimbostratus
Sure. Let's say your company has an app that connects to a web service from an external vendor. And you need to get to that app via "bar.foo.com/widget/some_uri". Now, your internal app server isn't on a routable IP address, so you'd like to go thru the F5, and have it proxy the communication with the external host. However, foo.com may have their own load balancing, or dns round-robin, or decide to change the ip address of host "bar" next week. Therefore, you can't have hard-coded ip address(es) as your pool member(s), or you'll have an outage every time they make a change. Therefore, you'd like to have the F5 resolve this host.domain - and preferably not cache it forever between restarts. - Nicolas_Menant
Employee
Hi, - Joe_Pawlicki_70
Nimbostratus
Great, thanks for the tip. Following from your link, there's a thread from 2006 that looks like they got it working exactly as I need. Testing... - Nicolas_Menant
Employee
if you can post the result if it works i'd be interested in seeing it ! - Joe_Pawlicki_70
Nimbostratus
Well, this is looking like "close, but no cigar". There appear to be a few gotchas. - hoolio
Cirrostratus
If name resolution is failing and you've followed the steps which worked for an older LTM version, you could open a support case with F5 to get help.
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