Documentation
¶
Overview ¶
Package proxy is an exact-host routing reverse proxy.
Requests are routed only when their normalized full Host header matches a hostname generated from the site's stored hostname identity. The registry is reloaded whenever sites.toml changes, so newly added sites route without a restart. Unknown or bare hosts get a landing page listing every site.
The Host header sent to the backend is rewritten to the backend's own address by default, so dev servers with host allowlists (Vite 5+, Next, Rails host authorization) accept proxied requests. Sites that need the original Host can set preserve_host = true. X-Forwarded-Host/Proto/For are always set from the inbound request.
httputil.ReverseProxy transparently handles HTTP/1.1 Upgrade (websockets), which jigyll live-reload and Vite/Next HMR depend on.
Index ¶
Constants ¶
const Slug = "__proxy"
Slug is the reserved state key for the background proxy process.
Variables ¶
This section is empty.
Functions ¶
func StartBackground ¶
StartBackground launches `servd proxy` detached and records it in state. It is a no-op if the proxy is already running.
func StopBackground ¶
func StopBackground() error
StopBackground signals the background proxy and clears its state entry.