11-Aug-2020 10:59
Hi,
So we have this multiple cnames for our website and was wondering if its possible in f5 to drop traffic if its not equal to our www.site.com . So basically, we wanted to drop any traffic that is being access through cname like cname.site.com or cname2.site.com and just dont let them connect. Can this be done on irule?
Thanks!
11-Aug-2020
11:10
- last edited on
04-Jun-2023
21:20
by
JimmyPackets
Hi lorenze,
when HTTP_REQUEST {
if {[string tolower [HTTP::host]] ne "www.site.com"} {
drop
}
}
11-Aug-2020
11:14
- last edited on
24-Mar-2022
02:08
by
li-migration
,
Thanks or the quick response. Will this make the page load for a couple of seconds and times out or just times out right away when accessed.
11-Aug-2020
14:05
- last edited on
24-Mar-2022
02:08
by
li-migration
also, how do I add another site to allow on this irule. This works by the way. Thank you!
11-Aug-2020
17:12
- last edited on
04-Jun-2023
21:20
by
JimmyPackets
when HTTP_REQUEST {
if { !([string tolower [HTTP::host]] equals "www.site.com" || [string tolower [HTTP::host]] equals "www.site2.com" || [string tolower [HTTP::host]] equals "www.site3.com") } {
drop
}
}
or
when HTTP_REQUEST {
switch [string tolower [HTTP::host]] {
"www.site.com" -
"www.site2.com" -
"www.site3.com" { }
default { drop }
}
}