Forum Discussion
What is the use of \nHost: www.example.com\r\n in an HTTP health monitor?
Do, I need to configure a Local DNS server to make this monitor work
1 Reply
- Kevin_Stewart
Employee
The health monitor is making an explicit GET request to a pool of web servers. If you've ever looked at an HTTP request on the wire (ie. not a browser but some tool like cURL), then you'd have seen something like this:
GET /something HTTP/1.1 Host: www.someplace.com Accept: *.* ... a bunch of other headers...
An HTTP request is this first line (method, resource, protocol version) followed by several lines of HTTP headers that tell the server attributes of the request and of the client. What you don't see in the above is the implied carriage return-line feeds. So what you're basically doing in the health monitor is putting all of the above on a single line and explicitly separating each line with \r\n (carriage return and line feed characters).
GET /something HTTP/1.1\r\nHost: www.something.com\r\nAccept: *.*\r\n...
Which then ends with TWO blank lines: \r\n\r\n
It just so happens that HTTP/1.1 per RFC requires that you submit a Host header. Most servers don't really care what the value is, as long as you send something. So you could just do:
Host: localhost.localdomain
But you do need it.
Recent Discussions
Related Content
* 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