Forum Discussion
Multiple http_request iRules not working Same Virtual server
hi nimbos
how to merge these http_request , could you please help
when HTTP_REQUEST {
if {([HTTP::header values "True-Client-IP"] equals "203.82.36.24") or ([HTTP::header values "True-Client-IP"] equals "11.50.154.146")
or ([HTTP::header values "True-Client-IP"] equals "180.91.158.114") or ([HTTP::header values "True-Client-IP"] equals "180.131.18.113")
or ([HTTP::header values "True-Client-IP"] equals "103.11.158.98") or ([HTTP::header values "True-Client-IP"] equals "11.54.23.2") or ([HTTP::header values "True-Client-IP"] equals "91.218.114.26") or
([HTTP::header values "True-Client-IP"] equals "91.28.11.4") or ([HTTP::header values "True-Client-IP"] equals "92.63.8.47") or
}{
HTTP::respond 400 content "site currently unavailable, Please try again later"
}
}
********************************************
when HTTP_REQUEST {
if { [string tolower [HTTP::host]] equals "energy.com" } {
HTTP::respond 301 Location "https://www.[HTTP::host][HTTP::uri]" "Connection" "Close"
return
}
elseif { [string tolower [HTTP::host]] equals "ndtv.com" } {
HTTP::respond 301 Location "https://www.[HTTP::host][HTTP::uri]" "Connection" "Close"
return
}
elseif { [string tolower [HTTP::host]] equals "corporate.ndtv.com" } {
HTTP::respond 301 Location "https://www.ndtv.co" "Connection" "Close"
return
}
}
or can we have two working irule ,one for http_request another irule for block external ips
- Hooni_LJan 19, 2023Cirrus
I think use date-group list and 'IF' on irule.
I couldn't test it, but I checked that it was set up in the equipment.
refer below irule and datagroup list:
when HTTP_REQUEST { if { [class match [HTTP::header values "True-Client-IP"] eq dg-client-ip] } { HTTP::respond 400 content "site currently unavailable, Please try again later" } elseif { [class match [HTTP::host] eq dg-domain] } { HTTP::respond 301 Location "https://www.[HTTP::host][HTTP::uri]" "Connection" "Close" return } }
- Yesh1923Jan 20, 2023Nimbostratus
i add below but its not working as expected , web page not loading
when HTTP_REQUEST {
if { [class match [HTTP::header values "True-Client-IP"] eq mo-client-ip] } {
HTTP::respond 400 content "site currently unavailable, Please try again later"
} elseif { [class match [HTTP::host] eq mo-domain] } {
HTTP::respond 301 Location "https://www.[HTTP::host][HTTP::uri]" "Connection" "Close"
return
}
}
Recent Discussions
Related Content
* 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