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 HTTP_REQUEST {
if { [HTTP::header exists "HOST"]} {
} else {
HTTP::header replace HOST [HTTP::host]
}
}
It appears that the host header is being added, but blank:
GET /includes HTTP/1.1
Content-Length: 2
HOST:
Any idea what I'm missing?
- James_Quinby_46Historic F5 AccountHTTP::host returns the value of the Host header. There's no value, so there's nothing to insert in your rule above.
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.
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