02-Jun-2020 10:07
HI Everyone,
I am looking for an irule where i need to redirect all the traffic from http to https expect for some URI's.
example: URI's: /abc , /bbc, /xyz anything starting with URI's traffic shouldn't be redirected.
Irule i wrote for working only for one URI but not for multiple , can some one help me how the irule looks for multiplr URI?
when HTTP_REQUEST {
if {not ([string tolower [HTTP::path]] starts_with "/abc")}{
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
Solved! Go to Solution.
02-Jun-2020
10:41
- last edited on
04-Jun-2023
21:26
by
JimmyPackets
Hello,
What about use "switch" ?
https://www.tcl.tk/man/tcl8.7/TclCmd/switch.htm
e.g.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::path]] {
"/abc*" -
"/bbc*" -
"/xyz*" {
# do nothing
}
default {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
}
Regards
02-Jun-2020
10:41
- last edited on
04-Jun-2023
21:26
by
JimmyPackets
Hello,
What about use "switch" ?
https://www.tcl.tk/man/tcl8.7/TclCmd/switch.htm
e.g.
when HTTP_REQUEST {
switch -glob [string tolower [HTTP::path]] {
"/abc*" -
"/bbc*" -
"/xyz*" {
# do nothing
}
default {
HTTP::redirect "https://[HTTP::host][HTTP::uri]"
}
}
}
Regards
05-Jun-2020
13:14
- last edited on
24-Mar-2022
01:16
by
li-migration
Thanks a lot for the suggestion , it works.