Forum Discussion
Need help to write an iRule
Hi All,
I need help to implement a change in my existing iRule. Main site should be accessible to intended IPs but two pages of this site (example: and should be accessible to everyone)
I created one data group list and kept all the intended IPs to access but now i am stuck here and don't know how to allow public access to and
Existing iRule: when HTTP_REQUEST priority 50 { if { [HTTP::host] equals "; } { set TCIP 0.0.0.0 set ALLOW 0 if { [HTTP::header exists True-Client-IP] } { set TCIP [HTTP::header True-Client-IP] if { [class match $TCIP equals Data_GroupList_Name] } { set ALLOW 1 } if { $ALLOW } { return } else { HTTP::respond 403 } } } } }
- Samir_Jha_52506
Noctilucent
Based on above condition, tried to frame irule. Validate it & confirm.
when HTTP_REQUEST priority 70 { if { ( [string tolower [HTTP::uri]] starts_with "/sumit" ) or ( [string tolower [HTTP::uri]] starts_with "/dubey" ) } { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } elseif { [matchclass [IP::client_addr] equals ADMIN-ALLLOWED-IP-LIST] } { HTTP::redirect "https://[HTTP::host][HTTP::uri]" } else { HTTP::respond 200 content { Apology Page We are sorry. Permission denied, Connect to Application Admin Team. } } }
- JG
Cumulonimbus
when HTTP_REQUEST priority 50 { if { [string tolower [HTTP::host]] equals "www.examples.com" } { if { [HTTP::header value "True-Client-IP"] != "" } { if { [class match [HTTP::header value "True-Client-IP"] equals Data_GroupList_Name] } { return } else { if { ( [string tolower [HTTP::path]] equals "/sumit" ) or ( [string tolower [HTTP::path]] equals "/dubey" ) } { return } } } HTTP::respond 403 content { Access Denied. You do not have permission to access this site. } noserver event disable all } }
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