Canonical host and HTTPS redirect policy
107-redirect-canonical-host-policy.yaml
HTTP(S)
What this example does
This example demonstrates canonical host and https redirect policy.
Checks and behavior
- Sends an GET request to http://example.com/.
- Checks allowed/denied HTTP status codes.
- Validates required, forbidden or matching HTTP headers.
- Validates redirect behavior and destination constraints.
- Formats results for nagios output.
Adapt example domains, addresses, credentials and thresholds to your environment before use.
YAML configuration
# Copyright (c) 2026 mati peterson. Maintainer: mati peterson <ipsonic@mailbox.org>. Project: https://ipsonic.com/probe/. Disclaimer: Provided AS IS, without warranty of any kind. Use at your own risk; validate checks and configurations before production use.
# Canonical-host policy: URL should end on HTTPS and stay on approved hosts.
name: "Canonical host and HTTPS redirect policy"
url: "http://example.com/"
request: {method: GET, follow_redirects: true}
timeouts: {connect: 3, response: 10}
tests:
status: {allow: [200]}
redirects:
max_count: 3
require_https: true
allowed_hosts: [example.com, www.example.com]
headers:
contains:
Content-Type: [text/html]
monitoring:
service_name: "Canonical HTTPS Redirect"
output: nagios
on_failure: critical