kraigk_52257
Jul 01, 2015Nimbostratus
Inefficient iRule, works but not perfect
We have a working iRule that I'm sure can be improved/. The first section is simple redirects from domain.org URL to equivalent https domain.com URL. We discovered that if users browsed directly to redirected URL (http://team.domain.com for example) they got nothing so we added the second section to address that. This works but with a few issues:
- browse to http://team.domain.com and it redirects to https://team.domain.com/default.aspx/ (trailing slash not desired)
- remove s from https from redirected site, hit enter and you get https://team.domain.com/default.aspx/default.aspx/ (multiple /default.aspx/)
- If you continue removing s from https it will keep creating these /default.aspx/,
It works still but isn't too pretty. Any help would be appreciated by a beginner..
when HTTP_REQUEST {
if { [HTTP::host] equals "team.domain.org" } {
HTTP::redirect "https://team.domain.com[HTTP::uri]"}
if { [HTTP::host] equals "site1.domain.org" } {
HTTP::redirect "https://site1.domain.com[HTTP::uri]"}
if { [HTTP::host] equals "site2.domain.org" } {
HTTP::redirect "https://site2.domain.com[HTTP::uri]"}
if { [HTTP::host] equals "myteam.domain.org" } {
HTTP::redirect "https://myteam.domain.com[HTTP::uri]"}
if { [HTTP::host] equals "team.domain.com" } {
HTTP::redirect "https://team.domain.com/default.aspx[HTTP::uri]"}
if { [HTTP::host] equals "site1.domain.com" } {
HTTP::redirect "https://site1.domain.com/default.aspx[HTTP::uri]"}
if { [HTTP::host] equals "site2.domain.com" } {
HTTP::redirect "https://site2.domain.com/default.aspx[HTTP::uri]"}
if { [HTTP::host] equals "myteam.domain.com" } {
HTTP::redirect "https://myteam.domain.com/default.aspx[HTTP::uri]"}
}