Forum Discussion
Brett_11764
Nimbostratus
Nov 15, 2007Redirection Woes
Hi,
I have written an iRule to redirect users based on the requests that they make. The thing I had to watch here was that the redirection was to the same VIP.
What I need:
1) User request does not include FQDN, redirect to original HTTP::host but include FQDN
2) If hostname includes specific text ("was"), continue without redirection
3) All other requests that do not include 'irj" in the URI, redirect to include the "irj".
So far the following seems to be working ok (any streamline suggestions would be welcome!):
when HTTP_REQUEST {
set uri [HTTP::uri]
set host [string tolower [HTTP::host]]
if {! ($host contains "domain.com") } {
if {( $uri equals "/" ) } {
if {! ($host contains "was" ) } {
HTTP::redirect "http://$host.domain.com/irj"
} else {
HTTP::redirect "http://$host.domain.com/$uri"
}
}
}
if {( $uri equals "/" ) } {
if {! ($host contains "was" ) } {
HTTP::redirect "http://$host/irj"
}
}
}
The problem I have though is that 1 in 10 requests that exclude the FQDN get a "page cannot be displayed". As soon as the user refreshes, the page loads. This problem does not exist when requesting the FQDN...
Anyone able to help?
- Don_Kindred_104
Nimbostratus
- Brett_11764
Nimbostratus
Hi, - Brett_11764
Nimbostratus
Ok, think I may have found the problem...
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