Forum Discussion
Adam_Borders_10
Aug 18, 2011Nimbostratus
iRule Newbie learning - need validation
I want to validate the this iRule will do as I think. What I want to do is evaluate the request for a redirect to https. If the user connects to domain.com instead of www.domain.com I want to add the ...
hooleylist
Sep 25, 2011Cirrostratus
Actually, I was wrong on this. string trim will remove any instances of individual characters--not just the literal string of "www.". So if your host starts with a w that isn't www., you will get an unintended result:
% string trimleft wily.example.com www.
ily.example.com
Here is a more accurate option using scan:
set host [string tolower [HTTP::host]]
if {[scan $host {www.%s} host_no_www] == 1 }{
set host $host_no_www
}
log local0. "\$host: $host"
Aaron
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