Forum Discussion
Mitch_Ryan_6222
Nimbostratus
May 27, 2008HTTP redirect
Hello,
I am trying to create a simple redirect such that our users can type abc.com and be redirected to: xyz.com:9091/path-to-database
I have tried borrowing iRule code from other posts:
when HTTP_REQUEST {
if { [HTTP::uri] equals "/"} {
HTTP::redirect "http://abc.com/path-to-database"}
}
This will not work - it generates a 'Page cannot be displayed' error. If I change the abc.com to xyz.com:9091 in the iRule then it will work but the user will see the real server name and port number in their address bar, which is not the desired behavior.
I also tried substituting the HTTP::redirect line with:
HTTP::redirect http://[HTTP::host][HTTP::uri]
BTW - abc.com has been set up in DNS and will resolve to the IP address of the virtual server on the F5. The F5's virtual server is set up to use a pool called abc, and this pool has the service port defined as 9091.
Perhaps this isn't an iRule problem and actually indicates some other configuration issue, and if so, then I apologize for posting here.
Mitch
- Leo_Katona_5507
Nimbostratus
If I understood correctly, you don't actually want to do a redirect but instead replace the URI "/" in incoming requests with "/path-to-database" and then take the user to the Virtual Server's default pool (abc). If this is the case, try this:when HTTP_REQUEST { if {[HTTP::uri] equals {/}} { HTTP::uri {/path-to-database} } }
- Singh_74932
Nimbostratus
From the post it looks like u want to redirect abc.com to xyz.com so is this xyz.com also configured on same bigip and registered ? - Mitch_Ryan_6222
Nimbostratus
In response to rajwinder:
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