Forum Discussion
kullwahad_19151
Nimbostratus
Jun 10, 2015error irules with regexp on HTTP::host
Hello,
I'm new to devcentral, can you help me for a default configuration of an irules.
here the irule
when HTTP_REQUEST {
set i 0
set host [string tolower [HTTP::host]]
if { $host match...
nitass_89166
Noctilucent
Jun 10, 2015can we just use split command and then concat whatever domain level you want?
e.g.
% set host www.google-analytics.com
www.google-analytics.com
% set lhost [split $host .]
www google-analytics com
% put [llength $lhost]
3
% put [lindex $lhost 0]
www
% put [lindex $lhost 1]
google-analytics
% put [lindex $lhost 2]
com
kullwahad_19151
Nimbostratus
Jun 11, 2015thanks to you, I managed to do it.
here for anyone for need it in a irule :
set host [string tolower [HTTP::host]]
set lhost [split $host .]
set nbrfield [llength $lhost]
set nbrendfiled [expr {$nbrfield - 1}]
set nbrdomainfiled [expr {$nbrfield - 2}]
set endfield [lindex $lhost $nbrendfiled]
set domainfield [lindex $lhost $nbrdomainfiled]
set endofhost "$domainfield.$endfield"
Thanks a lot !
Regards
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