Forum Discussion
If not path1 or path2 irule issue
Having a tough time with if/or. Any help is appreciated!!! This is close, but not working:
When request is from a public IP if the path is not /carinfoapi_usertest or /carinfoapi_dev, drop the packets otherwise, allow any pathwhen HTTP_REQUEST{ switch -glob -- [string tolower [HTTP::host]] { "host.domain.com"{ if { ! ([class match [IP::client_addr] equals private_net ]) }{ if { ! ( [string tolower [HTTP::path]] starts_with "/carinfoapi_dev" || "/carinfoapi_usertest" ) }{ reject } else { pool host.domain.com_pool } } else { pool host.domain.com_pool } return }
}
}
- msaunders
Nimbostratus
Figured it out. For some reason, the nested 'if' was causing an issue. Combining into one statement works:
when HTTP_REQUEST{ switch -glob -- [string tolower [HTTP::host]] { "host.domain.com"{ if { ! ([class match [IP::client_addr] equals private_net ]) && ! ([string tolower [HTTP::path]] starts_with "/carinfoapi_dev" || [string tolower [HTTP::path]] starts_with "/carinfoapi_usertest" ) }{ reject } else { pool host.domain.com_pool } 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