Forum Discussion
Marc_Bergeron_1
Nimbostratus
Sep 23, 2009Attempting to insert HOST to HTTP::header fails
I'm attempting to insert [HTTP::host] into any inbound requests where the HTTP::header host field is missing, but it doesn't appear to be working.
Straight-forward irule:
when H...
James_Quinby_46
Sep 23, 2009Historic F5 Account
HTTP::host returns the value of the Host header. There's no value, so there's nothing to insert in your rule above.
There's a bit more on HTTP::host here, including a couple of examples:
http://devcentral.f5.com/wiki/default.aspx/iRules/HTTP__host.html
RFC2616 (covering HTTP/1.1) says that if no host is given in the URI (as in your example output above), the Host header should be blank:
A client MUST include a Host header field in all HTTP/1.1 request
messages . If the requested URI does not include an Internet host
name for the service being requested, then the Host header field MUST
be given with an empty value. An HTTP/1.1 proxy MUST ensure that any
request message it forwards does contain an appropriate Host header
field that identifies the service being requested by the proxy. All
Internet-based HTTP/1.1 servers MUST respond with a 400 (Bad Request)
status code to any HTTP/1.1 request message which lacks a Host header
field.
So what you've got there is actually a legal request, even if it's not what you're looking for (which may be only a small comfort).
If you need to strip the host out of an absolute URL (see HTTP::uri) , you can probably do it and then stuff that into a Host header.
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