iRule to allow specific URL but block the root domain
We have a a mobile app that uses the URL /wfc. We need to block non-mobile access to the site by blocking the root domain from internet access.
This iRule will be assigned to the VS that processes this web traffic.
As a novice, I have used examples here to draft an iRule. I need help with the format, syntax and arguments. I know I'm missing a few brackets :-)
when HTTP_REQUEST {
log local0. "Requested connection [HTTP::host][HTTP::path], converted [string tolower [HTTP::host][HTTP::path]]"
if {[string tolower "[HTTP::host][HTTP::path]"] contains "/wfc"} {
log local0. "Accepted Connection [HTTP::host][HTTP::path], converted [string tolower [HTTP::host][HTTP::path]]"
forward
} else {[string tolower "[HTTP::host][HTTP::path]"] equals "subdomain.domain.org"} {
log local0. "Rejected Connection [HTTP::host][HTTP::path], converted [string tolower [HTTP::host][HTTP::path]]"
HTTP::respond 403 content{request Forbidden}
}
}
Thank you in advance for your advice and mentorship.