ltm rule command URI hostΒΆ

iRule(1)		      BIG-IP TMSH Manual		      iRule(1)



URI::host
       Returns the host portion of a given URI.

SYNOPSIS
       URI::host URI_STRING

DESCRIPTION
       Returns the host portion of a given URI.

       Syntax

       URI::host 

	    * Returns the host portion of a given URI.

RETURN VALUE
       Returns the host portion of a given URI.

VALID DURING
       ANY_EVENT

EXAMPLES
	when RULE_INIT {
		# Loop through some test URLs and URIs and log the URI::host value
		foreach uri [list \
			http://example.com/file.ext \
			http://example.com:80/file.ext \
			https://example.com:443/file.ext \
			ftp://example.com/file.ext \
			sip://example.com/file.ext \
			myproto://example.com/file.ext \
			/example.com \
			/uri?url=http://example.com/uri \
		] {
			log local0. "\[URI::host $uri\]: [URI::host $uri]"
		}
	}

	# Log output:
	[URI::host http://example.com/file.ext]: example.com
	[URI::host http://example.com:80/file.ext]: example.com
	[URI::host https://example.com:443/file.ext]: example.com
	[URI::host ftp://example.com/file.ext]: example.com
	[URI::host sip://example.com/file.ext]: example.com
	[URI::host myproto://example.com/file.ext]: example.com
	[URI::host /example.com]:
	[URI::host /uri?url=http://example.com/uri]:

	Sample log output from the above rule:
	     * Host of url http://www.foo.com/app/file.ext is www.foo.com
	     * Protocol of url http://www.foo.com/app/file.ext is http

HINTS
SEE ALSO
CHANGE LOG
       @BIGIP-9.0.0 --First introduced the command.



BIG-IP				  2017-01-31			      iRule(1)