httpserver

package
v0.0.0-...-acf2466 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 15, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package httpserver serves the single control-plane port (ADR-021, instance-config §2.1 AKERDOCK_PORT).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HealthOnly

func HealthOnly(health HealthCheck, logger *slog.Logger) http.Handler

HealthOnly is the handler of pure worker/scheduler modes: the port serves nothing but /api/v1/health (instance-config §6.1 step 6).

func New

func New(port int, handler http.Handler) *http.Server

New builds the HTTP server for the given port and handler.

func Robots

func Robots(next http.Handler) http.Handler

Robots answers /robots.txt for the whole control-plane port, before the request can reach the SPA — whose catch-all serves index.html for unknown paths, so a missing robots.txt would come back as HTML with a 200, which a crawler reads as "no rules". Permissive is not the same as absent: this one says so in plain text, to a crawler and to whoever curls it.

It is a middleware rather than a route so the answer does not depend on a dashboard build being embedded: an api-mode instance behind the same FQDN must give the same reply.

func SecurityHeaders

func SecurityHeaders(hsts bool) func(http.Handler) http.Handler

SecurityHeaders hardens every response of the single control-plane port: the dashboard, /auth, the API and /metrics all pass through here.

The policy is written for the dashboard (the only HTML this port serves) and is harmless on JSON: a Content-Security-Policy on an API response constrains nothing — unless a bug ever makes the API reflect HTML, at which point it is exactly the net we want under it.

hsts is derived from the instance FQDN being set, like the Secure cookie flag: promising browsers "always HTTPS" on a plain-HTTP instance would lock the operator out of their own dashboard for the header's max-age.

Types

type HealthCheck

type HealthCheck func(ctx context.Context) error

HealthCheck reports process health: nil means database reachable and master key loaded (instance-config §6.6).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL