Monitor your HTTP requests are redirected into HTTPS

Overview

Monitoring your HTTP traffic is redirected into HTTPS is critical in ensuring your users’ connections are encrypted with your API endpoints and your application.

Monitor your HTTPS redirection

Depending on your setup, you can identify the redirect to HTTPS in the generated Response Preview tab under Headers as location or in the Body as "https:"===window.location.protocol.

To monitor the redirection of your HTTP traffic into HTTPS:

  1. Create an HTTP test and define the request.

  2. Click Test URL. The response preview generates a Request Preview and Response Preview.

  3. Add an assertion about the redirection to HTTPS.

    • Define an assertion on the location header by clicking the location header in the response preview. For example, under Headers, the location header for http://datadoghq.com is https://datadoghq.com.
    Location header in the response preview
    • Alternatively, define an assertion on the response body by clicking + New Assertion. Select body contains and paste "https:"===window.location.protocol in the text field.
      Define your assertion

Complete the rest of the test creation workflow and save your HTTP test.

After defining the notification, Datadog can alert you when your HTTP traffic does not correctly redirect into HTTPS.

Further Reading

Additional helpful documentation, links, and articles: