main
Server entry point: generates the Caddyfile, starts Caddy and uvicorn.
attributelogger= logging.getLogger(__name__)attributecaddy_processsubprocess.Popen | None= NoneattributeHTTP_SITE= 'http://:{port} {{\n @stranger not remote_ip {networks}\n handle @stranger {{\n respond "This port serves the reverse proxies in SEALSKIN_TRUSTED_PROXIES alone, and {{remote_host}} is not one." 403\n }}\n @clear {{\n header X-Forwarded-Proto http\n header X-Forwarded-Proto ws\n }}\n handle @clear {{\n redir {public}{{uri}} 308\n }}\n @secure {{\n header X-Forwarded-Proto https\n header X-Forwarded-Proto wss\n }}\n handle @secure {{\n import entrance\n }}\n handle {{\n respond "The reverse proxy must send X-Forwarded-Proto: https with what it received over HTTPS." 403\n }}\n}}\n'funchttp_listener() -> boolWhether the plain HTTP listener is opened: http_port is set and a proxy is trusted to use it.
Returns
boolfuncadvertises_own_port() -> boolWhether browsers reach the session port under its own number, with no reverse proxy before it.
Caddy offers HTTP/3 in an Alt-Svc header that names the port it listens
on. Behind a reverse proxy or a remapped port that is another service's
port, or nobody's, so HTTP/3 is left off there.
Returns
boolfuncrun_caddy() -> NoneRender the Caddyfile template and start Caddy as a child process.
Returns
Nonefuncreload_caddy() -> NoneHave the running Caddy read its configuration again, as when the peer trust bundle changed.
Returns
Nonefuncstop_caddy(signum=None, frame=None) -> NoneStop the Caddy process group if it is still running.
paramsignumint | None= NoneSignal number when invoked as a signal handler.
paramframeAny= NoneCurrent stack frame (unused).
Returns
Nonefunc_serve() -> NoneStart Caddy and the API server, waiting until shutdown.
Returns
Nonefuncmain() -> NoneSynchronous entry point: install uvloop, install signal handlers, run.
Returns
None