Forum Discussion
fahmy_28867
Nimbostratus
Sep 15, 2010irule needed depend on URL not site ip
i have virtual server https load on http pool i need to create irule to accept the header if requet only with URL of the https site and deny any the request if it requested via the website ip .Any one can help me on this .Thanks in advance
7 Replies
- The_Bhattman
Nimbostratus
Hi Fahmy,
If I understand your question you want to basically only allow requests to make it through if they use domain name but deny those that use the IP addresses.
This code might help. Assuming that you created a white list datagroup.when HTTP_REQUEST { if hosts header does not match the whitelist then drop the request if { ![matchclass [HTTP::header "Host"] eq $::hostswhitelist] } { drop } }
I hope this helps
Bhattman - fahmy_28867
Nimbostratus
thanks Bhattman for your reply ,i'v a very short experience with irule so i need to ask about the white list data group how can i create it ,Is the white list include my URL ? say the url https://www.test.com/webaccess\ what is the change in the scripte attached?thanks for your patient .I will use your script as it is .
Thanks in advance - fahmy_28867
Nimbostratus
when HTTP_REQUEST { if { [HTTP::host] eq "https://www.test.com/webaccess\" } { drop } } }
is this scripte mean if header contain URL https://www.test.com/webaccess\ pass else drop ??
please advice, just i need simple irule accept URL drop https://10.10.10.1/webaccess\ - Chris_Miller
Altostratus
when HTTP_REQUEST { if { !([string tolower [HTTP::host]] eq "www.test.com") } { discard } }
This rule will only allow traffic destined for the host "www.test.com" and will discard (silently drop) anything else. - fahmy_28867
Nimbostratus
Hi Chris ,
when HTTP_REQUEST {
if { !([string tolower [HTTP::host]] eq "www.test.com.eg") } {
discard } }
if this string mean that if request come to www.test.com.eg or any sublink for this url like www.test.com.com/stuff will allow to this host and anything else will be dropped ,like request with ip , and I don’t need to write full URL https://www.test.com.eg
Please advice - Chris_Miller
Altostratus
Posted By fahmy on 09/16/2010 12:50 AM
Hi Chris ,
when HTTP_REQUEST {
if { !([string tolower [HTTP::host]] eq "www.test.com.eg") } {
discard } }
if this string mean that if request come to www.test.com.eg or any sublink for this url like www.test.com.com/stuff will allow to this host and anything else will be dropped ,like request with ip , and I don’t need to write full URL https://www.test.com.eg
Please advice
Correct - hoolio
Cirrostratus
If you just want to drop requests made by IP address, you could do a simple test for any alpha character instead of a specific white list. This would be less specific but more efficient than checking a datagroup for every request.
Here's an untested example:when HTTP_REQUEST { if { not [string match {*[a-zA-Z]*} [HTTP::header host]] }{ discard } }
Aaron
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