Forum Discussion
dkinsler_23191
Nimbostratus
Oct 13, 2010Redirect without rewriting host portion of URL
Hello all, I have a question about Redirecting. I have two VIPs and each has its own URL. I want one to redirect to the other under certain cconditions but I dont want the URL to change hosts. For instance....
I have mydomain1.com and mydomain2.com This Irule would be placed on mydomain1.com to redirect the contect to mydomain2.com if the URI starts with /stuff.
when HTTP_REQUEST { if { [HTTP::uri] starts_with "/stuff"} { HTTP::redirect "http://mydomain2.com/[HTTP::uri]" } }
The problem is, I dont want the users browser to see the domain change, but I want to get the contect from mydomain2.
Anybody have any ideas on how that should be done? Both vips are internal to the LB.
7 Replies
Sort By
- Chris_Miller
Altostratus
I'm assuming you have different pools for each VIP?when HTTP_REQUEST { {if { [HTTP::uri] starts_with "/stuff" } { pool pool_mydomain2 } { else pool pool_mydomain1 }}
- hoolio
Cirrostratus
If you want to hide the change in hostname from the client you would want to rewrite the Host header value and potentially select a different pool to send the requests to. You wouldn't want to send a redirect back to the client as this will update the address bar and the client will see the change. Is there a separate pool that serves content for mydomain2.com? Or is it the same as mydomain1.com? - hoolio
Cirrostratus
Sorry Chris, I didn't see your reply. - dkinsler_23191
Nimbostratus
It is a different pool associated with the mydomain2.com vip. - Chris_Miller
Altostratus
No worries Aaron. - Ben_95489
Nimbostratus
That's a great point, Chris. - hoolio
Cirrostratus
If it's a different pool for each host name, you'd want to use an iRule like Chris suggested. You'd probably also want to rewrite the Host header if the different pool members expect a specific hostname. You can do this with "HTTP::header replace Host newhost.example.com".
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