]> git.kaiwu.me - haproxy.git/commitdiff
DOC: config: mention that url_ip and url_port fail when passed a name
authorWilly Tarreau <w@1wt.eu>
Wed, 30 Sep 2026 12:28:07 +0000 (14:28 +0200)
committerWilly Tarreau <w@1wt.eu>
Wed, 30 Sep 2026 14:11:24 +0000 (16:11 +0200)
url_ip and url_port both rely on a call to url2sa() which tries to parse
digits in the authority part. This means that neither is usable with a
host name. For example www.example.org:443 will not return an IP address
nor even port 443 since the IP address parsing fails early. It's worth
being said since it's not obvious.

doc/configuration.txt

index 0122ea3016a1f7726d07e8c0e24b41642a9e7d83..a873678d2f01b257623b3d58d75715344bb6e64e 100644 (file)
@@ -28682,7 +28682,8 @@ url32+src : binary
 
 url_ip : ip
   This extracts the IP address from the request's URL when the host part is
-  presented as an IP address. Its use is very limited. For instance, a
+  presented as an IP address. The fetch fails when the host part is a name,
+  as no resolution is performed. Its use is very limited. For instance, a
   monitoring system might use this field as an alternative for the source IP in
   order to test what path a given source address would follow, or to force an
   entry in a table for a given source address. It may be used in combination
@@ -28690,7 +28691,9 @@ url_ip : ip
 
 url_port : integer
   This extracts the port part from the request's URL. Note that if the port is
-  not specified in the request, port 80 is assumed..
+  not specified in the request, port 80 is assumed. As for "url_ip", this only
+  works when the authority of the URL is presented as an address, the fetch
+  fails when it is a host name since no resolution is performed here.
 
 urlp([<name>[,<delim>[,i]]]) : string
 url_param([<name>[,<delim>[,i]]]) : string