Forum Discussion
Domain name access only
Hi LTM version 11.5.1, Please provide irules for domain name access application only .
Thankyou .
- JG
Cumulonimbus
It is not clear what your requirement is.
- PeteWhite
Employee
Do you mean an iRule that ensure that the client cannot access the application via the IP address? If so, that is very simple - just check the HTTP Host header.
when HTTP_REQUEST { if { [string tolower [HTTP::host] ] != "" } { reset } }
- yuanqiang_22112
Nimbostratus
@Pete White:
Try your irules, not work ; Modify the iruels can work :when HTTP_REQUEST { if { [string tolower [HTTP::host] ] != "www.f5.com" } { drop
log [HTTP::host] }
}Which string can expression all domain name , not work , you know ?
- Stanislas_Piro2
Cumulonimbus
Try that
when HTTP_REQUEST { if { !([string tolower [HTTP::host] ] ends_with "company.com") } { reset } }
- PeteWhite
Employee
OK. I meant that you should replace with the FQDN that your application is using.
I guess you are asking for an iRule that stops any requests with an IP address as the Host header.
when HTTP_REQUEST { if {[regexp {^(?:(\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5]))(?:\.((\d{1,2})|(1\d{2})|(2[0-4]\d)|(25[0-5]))){3}$} [HTTP::host]]} { reset } }
Note that regex is not very performant but this will check the host header against a regex for an IP address. You could consider using string match or the suggestion above by Stanislav if you know the domain that you want to use.
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