ltm rule command domain
iRule(1) BIG-IP TMSH Manual iRule(1)
domain
Parses the specified string as a dotted domain name and returns the
last portions of the domain name.
SYNOPSIS
domain DOMAIN COUNT
DESCRIPTION
A custom iRule function which parses the specified string as a dotted
domain name and returns the last portions of the domain name.
Syntax
domain
* Parses the specified string as a dotted domain name and returns the
last * portions of the domain name.
RETURN VALUE
VALID DURING
ANY_EVENT
EXAMPLES
when HTTP_REQUEST
if { [HTTP::uri] ends_with ".html" } {
pool cache_pool
set key [crc32 [concat [domain [HTTP::host] 2] [HTTP::uri]]]
}
...
This code:
log local0. [domain www.sub.my.domain.com 1] ; # result: com
log local0. [domain www.sub.my.domain.com 2] ; # result: domain.com
log local0. [domain www.sub.my.domain.com 3] ; # result: my.domain.com
log local0. [domain www.sub.my.domain.com 4] ; # result: sub.my.domain.com
log local0. [domain www.sub.my.domain.com 5] ; # result: www.sub.my.domain.com
log local0. [domain www.sub.my.domain.com 6] ; # result: www.sub.my.domain.com
This code:
log local0. [domain www.sub.my.domain.co.uk 1] ; # result: uk
log local0. [domain www.sub.my.domain.co.uk 2] ; # result: co.uk
log local0. [domain www.sub.my.domain.co.uk 3] ; # result: domain.co.uk
log local0. [domain www.sub.my.domain.co.uk 4] ; # result: my.domain.co.uk
log local0. [domain www.sub.my.domain.co.uk 5] ; # result: sub.my.domain.co.uk
log local0. [domain www.sub.my.domain.co.uk 6] ; # result: www.sub.my.domain.co.uk
(* A bug in v9.1.0 truncates last character if = 1 or 2.)
HINTS
SEE ALSO
CHANGE LOG
@BIGIP-9.0.0 --First introduced the command.
BIG-IP 2017-01-31 iRule(1)