Endpoints and routing
An endpoint is a tuple: (domain, service, port, tls_mode, protocol, path). One app can declare multiple endpoints, and several endpoints may share a domain. Each endpoint becomes one Caddy route. Caddy receives all inbound traffic on :80 and :443 and matches by Host header, plus the optional path and gRPC content-type matchers.
Declaring endpoints
Section titled “Declaring endpoints”Endpoints are indexed labels on any service in the app. The reconciler reads simpledeploy.endpoints.N.* for N = 0, 1, 2, ...:
services: web: image: ghcr.io/example/web:1.4 ports: ["8080"] labels: simpledeploy.endpoints.0.domain: "app.example.com" simpledeploy.endpoints.0.service: "web" simpledeploy.endpoints.0.port: "8080" simpledeploy.endpoints.0.tls: "auto"
simpledeploy.endpoints.1.domain: "admin.example.com" simpledeploy.endpoints.1.service: "web" simpledeploy.endpoints.1.port: "8080" simpledeploy.endpoints.1.tls: "auto"Two endpoints, both pointing at the same service, served on two different domains.
Upstream resolution
Section titled “Upstream resolution”For each endpoint, /internal/proxy/route.go (resolveEndpointUpstream) picks where Caddy proxies to, in this order:
- If the target service publishes a host port matching
endpoint.port, the upstream islocalhost:<host_port>. - Otherwise, the resolver looks up the service’s container IP on the
simpledeploy-publicnetwork via the Docker API and uses<container_ip>:<port>. Every endpoint-bearing service is auto-attached to this network by the compose mutation step during deploy, so Caddy can reach it whether SimpleDeploy runs natively on Linux (bridge IPs are host-routable) or inside a container on the same network. - As a last-ditch fallback when the Docker API lookup fails (daemon down, container not yet attached), the upstream is the Docker DNS name
<service>:<port>. Only works when Caddy and the target share a network.
You do not need to publish a host port to make an endpoint reachable. Host ports still work and, when present, take precedence (step 1).
TLS modes
Section titled “TLS modes”Set per endpoint via simpledeploy.endpoints.N.tls:
auto(default): Caddy obtains a Let’s Encrypt cert via ACME using the email fromtls.emailin your config.local: Caddy uses its internal CA. Useful for dev/staging without public DNS.custom: Caddy loads<app_dir>/certs/<domain>.crtand.keyfrom disk.off: HTTP only. Caddy’s automatic HTTPS is disabled globally when this is the proxy-wide mode.
The proxy-wide mode comes from your config (tls.mode). Per-endpoint TLS modes layer on top. See TLS guide for the full matrix.
Protocols and paths
Section titled “Protocols and paths”Two optional labels refine an endpoint:
simpledeploy.endpoints.N.protocol:http(default),h2corgrpc.h2candgrpcproxy to the upstream over HTTP/2 cleartext with immediate flushing.grpcadditionally only matches native gRPC requests (Content-Type: application/grpc*, gRPC-Web excluded).simpledeploy.endpoints.N.path: a Caddy path matcher such as/ws*.
labels: simpledeploy.endpoints.0.domain: "api.example.com" simpledeploy.endpoints.0.port: "50051" simpledeploy.endpoints.0.protocol: "grpc" simpledeploy.endpoints.1.domain: "api.example.com" simpledeploy.endpoints.1.port: "8000" simpledeploy.endpoints.1.path: "/ws*" simpledeploy.endpoints.2.domain: "api.example.com" simpledeploy.endpoints.2.port: "8001"Route order per domain is fixed: grpc endpoints, then path endpoints (longest path first), then the catch-all. Every route is terminal, so the first match wins. Endpoints whose matchers collide (same domain, same path, both or neither grpc), or that share a domain with different tls modes, are rejected at deploy time. For apps already on disk the reconciler only warns and keeps the first endpoint (by label index N).
What Caddy actually gets
Section titled “What Caddy actually gets”Routes are built in /internal/proxy/proxy.go (buildConfig) and pushed via caddy.Load() after every reconcile. Each route gets a handler chain in this order:
simpledeploy_ipaccess(allowlist match againstsimpledeploy.access.allow)simpledeploy_ratelimit(per-domain token bucket, configured viasimpledeploy.ratelimit.*)simpledeploy_metrics(records request count, latency and status code for the app’s request stats, including the502visitors get when the app cannot be reached)headers(safe-default security headers, see below)timeouts(HTTP routes only: cuts uploads that stall for a minute)reverse_proxyto the resolved upstream
Default security headers
Section titled “Default security headers”SimpleDeploy adds these headers to your app’s responses, but only when your app does not already send them. If your app sets its own value (for example X-Frame-Options: DENY), that value is kept.
| Header | Default value | When |
|---|---|---|
X-Content-Type-Options |
nosniff |
Always |
X-Frame-Options |
SAMEORIGIN |
Always |
Referrer-Policy |
strict-origin-when-cross-origin |
Always |
Strict-Transport-Security |
max-age=31536000; includeSubDomains |
Endpoints whose tls is not off |