Forum Discussion
cxcal_18687
Nimbostratus
Jan 26, 2011HTTP and URI Redirect
Can someone assist with a iRules with the following requirements:
1) When a client hits "" they should be redirected to "https:///Proxy"
2) If clients hits they should be redirected to https:///Proxy"
Any help would be greatly appreciated!
11 Replies
- cxcal_18687
Nimbostratus
CORRECTION...
1) When a client hits "http:///" they should be redirected to https://10.10.10.1/Proxy
2) If clients hits https:/// they should be redirected to https://10.10.10.1/Proxy"
Both requests should direct the traffic to pool "VLProxy"
Thanks. - Colin_Walker_12Historic F5 AccountI'm a bit confused. http:/// won't get anyone to your server, let alone to the appropriate VIP. What hostname did you want to search for?
Colin - cxcal_18687
Nimbostratus
Right now I have not been provided a hostname. Only the IP. But they will use something like "medstest.com".
Thanks. - Colin_Walker_12Historic F5 AccountOkay, so you just want a redirect that works for either HTTP or HTTPS?
So you create a virtual for each (or one that listens on both) with an irule like:when HTTP_REQUEST { if {([HTTP::host] eq "medtest.com") and ([HTTP::uri] eq "/")} { HTTP::redirect "https://10.10.10.1/Proxy" } }
You can ignore whether they're coming in on http or https if you want to redirect both to the same place anyway. Then you'd just set up a vip for 10.10.10.1 that points to the VLProxy pool.
Alternatively you could get tricky and just do host name re-writing and pool routing in one iRule, but the redirect route is simpler and would actually change the host for the user, which might be preferable.
Colin - cxcal_18687
Nimbostratus
Thanks.. I will test this out.
Appreciate it..
I'll let you posted... - Colin_Walker_12Historic F5 AccountSure thing, let me know how it goes.
Colin - cxcal_18687
Nimbostratus
Script would not take on the load balancer..
After reviewing it, I realized the script should redirect to https and use the pool.
What changes should be made since your last post to accomplish this? - cxcal_18687
Nimbostratus
The iRule below hangs when executed http://hostname.com and then times out.
My goal is for the request to hit the VIP and redirect to https, and connect to the pool of servers
What am I doing wrong????
when HTTP_REQUEST {
if { [HTTP::host] equals "uat.ac.com" and [HTTP::uri] equals "/"} {
HTTP::redirect "https://uat.ac.com/Portal"
}
}
Appreciate the help! - cxcal_18687
Nimbostratus
OK...a reboot fixed the fact that I could not see any VIP traffic at all.. go figure...
So I have the iRule below working, but it does not redirect clients to https://hostname/VLPortal as expected. Any advice on how to correct this?
when HTTP_REQUEST {
if { [HTTP::uri] contains "/VLPortal" } {
use pool VLProxy_Servers_443
} elseif { [HTTP::uri] equals "/" } {
use pool VLProxy_Servers_443
}
}
Flip side... when I attempted to use a redirect statement, I get the following error:
"HTTP:host requires an associated HTTP profile on the virtual server".. so I recreated the VIP and assigned a http (performance profile) but the clients fail to receive data. It just hangs, and later times out.
Am I missing something here???
NEED HELP BAD...
Thanks. - Colin_Walker_12Historic F5 AccountOkay, so if you want to use the HTTP::redirect command, you need an HTTP profile assigned to the VIP. Try using the base HTTP profile and see how that treats you.
Other than that, this rule looks completely correct:when HTTP_REQUEST { if { [HTTP::host] equals "uat.ac.com" and [HTTP::uri] equals "/"} { HTTP::redirect "https://uat.ac.com/Portal" } }
If you're getting hung connections when running this iRule, and no errors are showing up in the LTM logs, I'd recommend running something like HTTPWatch or the like to see what's actually happening with the connection. Is it in a redirect loop? Is the back end rejecting the connection? What errors are showing up and from where?
Colin
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
