Forum Discussion
Need an Irule
My Requirement is
When URI stats_with /api/superman and /api/xmen for it shud only allow to 1.1.1.1 and 2.2.2.2 and 3.3.3.3
thanks Sachin M
3 Replies
- janholtz
Altostratus
No, I don't understand that question. Can you draw a diagram?
BR Jan
- janholtz
Altostratus
So, to add to Maneesh's excellent irule
if { [HTTP::host] equals "www.xyz.com" } { switch -glob [string tolower [HTTP::uri]] { "/api/admin/" - "/api/account/" { if { ([class match [IP::client_addr] equals YOUR_DATA_GROUP_WHICH_HAS_3_IP's] )} { YOUR_API_POOL } else { reject } } } } }
BR
Jan
- Hectorm
Nimbostratus
I will change the user input to lower case since the if statement is case sensitive. Also make sure you create the data group. To create the data group do the following: * go to local traffic/Irules/data group List * Click on Create * name:data_group1 * type: Address Under records Address: 10.1.1.5/32 <--This is the IP that you want to allow value : 10.1.1.5/32 Click add and repeat to enter other workstation when you are done click finished
when HTTP_REQUEST {
set Vuri [ string tolower [HTTP::uri]] set Vheader [ string tolower [HTTP::host]]
if { $Vheader equals "www.xyz.com"} { switch -glob $Vuri { "/api/account/" { if { ([class match [IP::client_addr] equal data_group1 ] )} then { pool pool_name } else { reject } } "/api/admin/" { if { ([class match [IP::client_addr] equal data_group1 ] )} then { pool pool_name } else { reject } } default { pool pool_name } } }
}
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