Forum Discussion
Dixit_18200
Nimbostratus
Feb 23, 2010Help needed for irule issue
Hi,
I have setup two irules for http to https redirection
1st for redirecting the below websites
http://www.acbg.com/ucc
http://www.acbg.com/saleshub
http://www.acbg.com/cct
and the irule i have appiled for this is as below
when HTTP_REQUEST {
if {[HTTP::uri] ends_with "/ucc"} {
HTTP::redirect "https://microsite.accenture.com/ACBG/Solutions/UCandC/Pages/default.aspx"
}
elseif {[HTTP::uri] ends_with "/saleshub"} {
HTTP::redirect "https://microsite.accenture.com/ACBG/Pages/SalesHub.aspx"
}
elseif {[HTTP::uri] ends_with "/cct"} {
HTTP::redirect "https://microsite.accenture.com/ACBG/Solutions/CustomerContact/Pages/default.aspx"
}
}
2nd irule for redirecting below websites
http://www.acbg.com/saleshub/dc
http://www.acbg.com/saleshub/ins
http://www.acbg.com/saleshub/ucc
http://www.acbg.com/saleshub/cct
http://www.acbg.com/saleshub/os
when HTTP_REQUEST {
if {[HTTP::uri] ends_with "/saleshub/ucc"} {
HTTP::redirect "https://microsite.accenture.com/ACBG_SalesHub/solutions/Pages/Outsourcing.aspx"
}
elseif {[HTTP::uri] ends_with "/saleshub/cct"} {
HTTP::redirect "https://microsite.accenture.com/ACBG_SalesHub/solutions/Pages/CCT.aspx"
}
elseif {[HTTP::uri] ends_with "/saleshub/dc"} {
HTTP::redirect "https://microsite.accenture.com/ACBG_SalesHub/solutions/Pages/DataCenterSolutions.aspx"
}
elseif {[HTTP::uri] ends_with "/saleshub/ins"} {
HTTP::redirect "https://microsite.accenture.com/ACBG_SalesHub/solutions/Pages/InfrastructureSolutions.aspx"
}
elseif {[HTTP::uri] ends_with "/saleshub/os"} {
HTTP::redirect "https://microsite.accenture.com/ACBG_SalesHub/solutions/Pages/Outsourcing.aspx"
}
}
however for the below websites the irule is not working properly. When i remove the first irule the below redirection works perfecrtly. Please help
http://www.acbg.com/saleshub/ucc
http://www.acbg.com/saleshub/cct
- Hamish
Cirrocumulus
Is there anything else in the iRules? Or are they just a single event? Two iRules shoould both fire, one after tjhe other, unless the first has a discard, drop or event statement...class URIredirects { "/dir1/dir2/dir3/ http://somehost.somewhere.com/redirect_target.html" "/dir4/dir5/dir6/ http://someotherhost.nowhere.com/redirect_target.html" } when HTTP_REQUEST { set location [findclass [HTTP::uri] $::URIredirects " "] if { $location ne "" } HTTP::redirect $location } }
- hoolio
Cirrostratus
I'd guess this is an issue with trying to send a redirect from both rules on the same request. /var/log/ltm should show a runtime TCl error about multiple redirect invocations. For example, http://www.acbg.com/saleshub/ucc is going to match the first iRule check for a URI ending with /ucc and the second iRule check for /saleshub/ucc.switch -glob [string tolower [HTTP::uri]] { "*/saleshub/ucc" { HTTP::redirect "https://microsite.accenture.com/ACBG_SalesHub/solutions/Pages/Outsourcing.aspx" } "*/ucc" { HTTP::redirect "https://microsite.accenture.com/ACBG/Solutions/UCandC/Pages/default.aspx" } default { Take some default action } }
- Dixit_18200
Nimbostratus
Hi Aaron/Hamish, - hoolio
Cirrostratus
Sorry, that was a code snippet. It would need to be in the HTTP_REQUEST event:when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "*/saleshub/ucc" { HTTP::redirect "https://microsite.accenture.com/ACBG_SalesHub/solutions/Pages/Outsourcing.aspx" } "*/ucc" { HTTP::redirect "https://microsite.accenture.com/ACBG/Solutions/UCandC/Pages/default.aspx" } default { Take some default action } } }
- Dixit_18200
Nimbostratus
Hey Aaron, - JRahm
Admin
Just extend Aaron's example:when HTTP_REQUEST { switch -glob [string tolower [HTTP::uri]] { "*/saleshub/ucc" { HTTP::redirect "https://microsite.accenture.com/ACBG_SalesHub/solutions/Pages/Outsourcing.aspx" } "*/saleshub/cct" { HTTP::redirect "https://microsite.accenture.com/ACBG_SalesHub/solutions/Pages/CCT.aspx" } "*/ucc" { HTTP::redirect "https://microsite.accenture.com/ACBG/Solutions/UCandC/Pages/default.aspx" } "*/cct" { HTTP::redirect "https://microsite.accenture.com/ACBG/Solutions/CustomerContact/Pages/default.aspx" } default { Take some default action } } }
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