Forum Discussion
winifred_corbet
Nimbostratus
May 20, 2010allow access to URL by specific IP range - all others rejected
For a specific URL I need to allow access to URL only to our internal IP range, all other IP addresses need to be rejected.
Something along these lines, but clearly this is not correct. Can anyone help?
when HTTP_REQUEST {
{[HTTP::uri] "special_file"}
{ [IP::addr [IP::remote_addr] equals 72.xxx.xxx.0/72.xxx.xxx.26 ] } {
reject
}
}
9 Replies
- Michael_Yates
Nimbostratus
Sorry...I had to edit my first post and the format is never the same after an edit:
Go into your LTM under iRules -> Data Group List
Create -> Name it -> Type Address
Add the IP Addresses (or configure the Network Range) that you want to allow (Then replace the "PoolOfAllowedAddresses" with the name of the group you created).when HTTP_REQUEST { if { [HTTP::host] equals "www.website.com" and ([matchclass [IP::remote_addr] equals $::PoolOfAllowedAddresses ]) } { pool poolofallowedservers } else { reject } }
This is designed to Accept anything in the Data Group and Reject everything else. - winifred_corbet
Nimbostratus
excellent. I will give it a try. Thanks. - winifred_corbet
Nimbostratus
Another question:
I need to specify if a 'specific" URL is hit and they are *not* coming from the IP range called out in 'Data group List" I need to reject them.
So,
If "a Specific Full URL" and *not* coming from "data Group List" --- reject them - Michael_Yates
Nimbostratus
If you need to be extremely specific you can have it check the URI as well.when HTTP_REQUEST { if { [HTTP::host] equals "www.website.com" and [HTTP::uri] equals "/somethingspecific/index.html" and [matchclass [IP::remote_addr] equals $::PoolOfAllowedAddresses ]) } { pool poolofallowedservers } else { reject } }
If you want exclusive over inclusive you can make a few modifications:when HTTP_REQUEST { if { [HTTP::host] equals "www.website.com" and [HTTP::uri] equals "/somethingspecific/index.html" and !([matchclass [IP::remote_addr] equals $::PoolOfAllowedAddresses ]) } { reject } else { pool poolofallowedservers } }- Ahmad_Ghazal_17
Nimbostratus
Hi, what the following line means, and what it's used for? pool poolofallowedservers - nitass
Employee
poolofallowedservers is pool name. the command does send traffic to that pool.
- If you need to be extremely specific you can have it check the URI as well.
when HTTP_REQUEST { if { [HTTP::host] equals "www.website.com" and [HTTP::uri] equals "/somethingspecific/index.html" and [matchclass [IP::remote_addr] equals $::PoolOfAllowedAddresses ]) } { pool poolofallowedservers } else { reject } }
If you want exclusive over inclusive you can make a few modifications:when HTTP_REQUEST { if { [HTTP::host] equals "www.website.com" and [HTTP::uri] equals "/somethingspecific/index.html" and !([matchclass [IP::remote_addr] equals $::PoolOfAllowedAddresses ]) } { reject } else { pool poolofallowedservers } }- Ahmad_Ghazal_17
Nimbostratus
Hi, what the following line means, and what it's used for? pool poolofallowedservers - nitass
Employee
poolofallowedservers is pool name. the command does send traffic to that pool.
Help guide the future of your DevCentral Community!
What tools do you use to collaborate? (1min - anonymous)Recent Discussions
Related Content
DevCentral Quicklinks
* 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
Discover DevCentral Connects
