Forum Discussion
madi_56757
Nimbostratus
Mar 11, 2005http forwarding with irule
hello,
I will confiugure a irule to forward to specific URL
the connection will be open to my VIP https://server1.com/123/456.html
and the BIGIP should forward this to http://testserver.de/123/456.html
my suggestion
when HTTP_REQUEST {
if { [HTTP::host] matches_regex "server1.com" } {
and now forward to http://testserver.de[HTTP::uri]
}
}
please help
5 Replies
- Anthony_Vaz_547
Nimbostratus
Hi there
Do you wish to forward the traffic to the second server or redirect the client to that second server?
If you are forwarding the traffic - then the second server could just be in a bigip pool that is referenced either by the irule or as a default pool for the VS.
If you are redirecting have a look at the HTTP::redirect function as this should be able to work.
I hope this helps - madi_56757
Nimbostratus
hello
Ok, a redirect is not possible because the client should open the connection to testserver1.de about the VIP on the LB https://server1.com
This is like a tunneling
the client shouldn't notice does he connecting another host
Thanks - madi_56757
Nimbostratus
sorry to adjustment
the client shouldn't notice does he get data from another host - unRuleY_95363Historic F5 AccountDo you need to forward using the DNS name (testserver.de)?
If you can use the IP address instead, you could simply do the following since you are not changing the URI:when HTTP_REQUEST { if { [HTTP::host] matches_regex "server1.com" } { Replace the Host: header with the new name HTTP::header replace "host" "testserver.de" You could also modify the uri with HTTP::uri "new uri" a.b.c.d is the IP address of testserver.de use node a.b.c.d 80 } }
If you do need to use the DNS name, then you will want to look at the following post:
Click here for link - madi_56757
Nimbostratus
Thanks for your help!
It works fine, the final irule:when HTTP_REQUEST { set uri [HTTP::uri] set new_host testserver.de set new_url $new_host$uri if { [HTTP::host] matches_regex "server1.com" } { HTTP::uri http://$new_url } }
---------------------------------------------------------
Cheers
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)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