Files
static-web-server/docs/content/features/health-endpoint.md
Matthias Schoettle 12387a88bb docs: improve docs configuration and fix anchor links (#504)
* Fix anchor links in documentation

* Move strict to mkdocs config

* add mkdocs to CI

---------

Co-authored-by: Jose Quintana <1700322+joseluisq@users.noreply.github.com>
2024-12-01 13:22:16 +01:00

988 B

Health endpoint

SWS provides an optional /health endpoint that can be used to check if it is running properly. When the /health is requested, SWS will generate a log only at the debug level instead of the usual info level for a regular file.

The HTTP methods supported are GET and HEAD.

This feature is disabled by default and can be controlled by the boolean --health option or the equivalent SERVER_HEALTH env.

Usage with Kubernetes liveness probe

The health endpoint is well suited for the Kubernetes liveness probe:

apiVersion: v1
kind: Pod
metadata:
  name: frontend
spec:
  containers:
    - name: sws
      image: frontend:1.0.0
      command:
        - static-web-server
        - --root=/public
        - --log-level=info
        - --health
      ports:
      - containerPort: 80
        name: http
      livenessProbe:
        httpGet:
          path: /health
          port: http