/
Creating HTTP Health Checks

Creating HTTP Health Checks

An HTTP health monitor sends either an HTTP or HTTPS request to the server. The health monitor then examines the response received from the server. The validation is successful if the server returns a response with the expected result code. The HTTP/HTTPS monitor can validate the response code and response content. The response content is checked only when the response code is valid.

Complete the following steps to create an HTTP Health Check monitor:

  1. Go to Configure > Networking > DNS > DTC > DTC Health Checks.

  2. Click Create DTC Health Check > HTTP.

  3. Configure the following in the HTTP Health Monitor dialog:

    • Name: Enter a name for the HTTP health monitor.

    • Description: Enter a description for the health monitor.

    • Use HTTPS: Toggle to Enabled to use HTTPs.

    • Port: Specify a port number.

    • HTTP Request: Specify the HTTP request. You can specify a multi-line message and include HTTP headers in the request by using the HTTPRequest field in the HTTP health monitor properties. The header lines of an HTTP request have the simple name: value syntax. The request headers are used to pass cookies, authentication, and provide information about the client to the server, etc.
      The HTTP 1.1 contains a request line and a single host header:

      Example 1:

      GET / HTTP/1.x
      Host: www.test.com
      Connection: close

      Example 2:

      GET /index.html HTTP/1.x
      Host: www.example.com

      • Note that the lines are terminated with two chars \r\n.

      • The whole request terminates with an empty line "\r\n\r\n" character sequence.

      • NIOS-X Server adds \r\n\r\n string if it is absent. You can request GET / instead of " GET/index.html". 
        The host header differentiates between several HTTP servers that are running on a single IP address on the same port.
        In HTTP 1.1, the server keeps the connection alive by default after the response is sent. You can disable the connection by adding a Connection: close header line to the request.
        An HTTP 1.0 request may consist of a single line followed by the automatically added \r\n\r\n: 
        GET /index.html HTTP/1.0
        Or in the most simple form: 
        GET / HTTP/1.0
        The server closes the connection after the response has been sent. You can use  Connection:
        Keep-Alive header to alter this behavior. The Content-Length header is important to determine the end of the response for keep-alive connections.
        Apart from HTTP 1.0/1.1, NIOS-X Server also supports a request format known as HTTP 0.9: GET /index.html or GET /

      Normally, the response header consists of a response line, such as HTTP/1.1 200 OK or HTTP/1.0 400 Bad Request, followed by a couple of header lines, and then by an empty line which signals the end of the response header. With HTTP 0.9, the response immediately starts with the content of the requested file, which means that there is no HTTP return code for an HTTP 0.9 request.

    • Status Code(s): Choose Any for any status code. Choose Equal and specify the status codes.

    • Interval (seconds): Enter the interval value in seconds. The health monitor runs only for the specified interval and it is measured from the begining of the previous monitor cycle. The default value is 15.

    • Timeout (seconds): Enter the timeout value in seconds. The monitor waits for the number of seconds that you specify after sending a request. If the monitor does not receive a response within the number of seconds that you specify, then it considers this check as failed. The monitor discards any response it receives after the timeout. The default value is 10.

    • Retries for Healthy Status: Enter an integer value. This value determines how many valid responses or good health checks in a row must be received by the monitor from the DTC server.

    • Retries for Down Status: Enter an integer value. It is the opposite of the Retries for Healthy Status count. This value determines how many unhealthy status health checks (server is unavailable) in a row must be collected by the monitor from the DTC server.

    • Response Content: Configure the following to search in the response content.

      • Do not check the response content: Choose this option if you do not want to search the response content.

      • Search for a string in the response content: Choose this option to search for the response content and choose where to search:

        • Header

        • Body

        • Both The Header And Body

      • Regular Expression: Click Add and configure a regular expression.

        • Header

        • Regular Expression

      • Content is valid if the regular expression is: Choose Found or Not found from the drop-down.

  4. Click Save & Close.