Forum Discussion
snjk_65602
Nimbostratus
Sep 25, 2012Need help to convert iRule from ver 4 to ver 11.
I have the follwoing iRule in ver 4-
rule LMS_dev{
if (http_host matches_regex "d2lstg.smu.edu.sg")
if (http_host matches_regex "d2lstg.smu.edu.sg") {
redirect to ""
}
else if (http_host matches_regex "xn--yfro4i6sbzxdg8th3unfm.edu.sg") {
redirect to "http://www.smu.edu.sg/%u"
}
The same has been convered to ver 11 as below but not working-
when HTTP_REQUEST {
if {[HTTP::host] matches_regex "d2lstg.smu.edu.sg"} {
HTTP::redirect "]"
}
elseif {[HTTP::host] matches_regex "xn--yfro4i6sbzxdg8th3unfm.edu.sg"} {
HTTP::redirect "http://www.smu.edu.sg/%u"
}
Pl help to resolve this. Thanks.
1 Reply
- nathe
Cirrocumulus
snjk
I know regex queries aren't recommended due to cpu resources. thought I'd try and rewrite without. Hope this works. If not you may want to repost in the iRules v4 forum to get some iRuling experts to take a look in case they miss it here.when HTTP_REQUEST { switch -glob [HTTP::host] { "*d2lstg.smu.edu.sg*" { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } "*xn--yfro4i6sbzxdg8th3unfm.edu.sg*" { HTTP::redirect "http://www.smu.edu.sg[HTTP::uri]" } } }
Rgds
N