Forum Discussion
Magnum_IP
Sep 29, 2011Nimbostratus
HTTP::uri returns full URL
I have had reason to log HTTP::uri while troubleshooting an error on a new Virtual Server. When I log HTTP::uri I see the full URL including protocol, for example,
http://www.domain.com/dir...
hooleylist
Sep 29, 2011Cirrostratus
Hi Fergu,
An HTTP request can contain an absolute URI per RFC2616:
http://tools.ietf.org/html/rfc2616section-5.1.2
5.1.2 Request-URI
The Request-URI is a Uniform Resource Identifier (section 3.2) and
identifies the resource upon which to apply the request.
Request-URI = "*" | absoluteURI | abs_path | authority
The four options for Request-URI are dependent on the nature of the
request. The asterisk "*" means that the request does not apply to a
particular resource, but to the server itself, and is only allowed
when the method used does not necessarily apply to a resource. One
example would be
OPTIONS * HTTP/1.1
The absoluteURI form is REQUIRED when the request is being made to a
proxy. The proxy is requested to forward the request or service it
from a valid cache, and return the response. Note that the proxy MAY
forward the request on to another proxy or directly to the server
specified by the absoluteURI. In order to avoid request loops, a
proxy MUST be able to recognize all of its server names, including
any aliases, local variations, and the numeric IP address. An example
Request-Line would be:
GET http://www.w3.org/pub/WWW/TheProject.html HTTP/1.1
To allow for transition to absoluteURIs in all requests in future
versions of HTTP, all HTTP/1.1 servers MUST accept the absoluteURI
form in requests, even though HTTP/1.1 clients will only generate
them in requests to proxies.
You can detect a relative URI by checking if HTTP::uri or HTTP::path start with "/". If not, it should be an absolute URI. You can use the URI:: commands to parse an absolute URI into the protocol, host and relative URI/path:
http://devcentral.f5.com/wiki/iRules.URI.ashx
http://devcentral.f5.com/wiki/iRules.URI__path.ashx
http://devcentral.f5.com/wiki/iRules.URI__host.ashx
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