code wiki / (root) / nx_pages_http_redirect.nx

nx_pages_http_redirect.nx

buildroot/runtime/nx_pages_http_redirect.nx

5288 B153 linesdepth 4pulls 5 transitivereach 0 importersview sourcekind tooltopic pages
docsdependenciesstructsconstsfunctions

about

nx_pages_http_redirect.nx -- D1.4 of NISHI_DEPLOY_ROADMAP. Tiny daemon that listens on :80 and 301-redirects every request to the same Host + path on https://. This is the partner of D1.3's nx_pages_https_daemon -- together they replace nginx's TLS termination + ACME http-01 challenge surface (when D1.5 lands, this daemon also serves /.well-known/acme-challenge/ for renewals). V1 behaviour: - GET / -> 301 Location: https://<Host>/ - GET /foo/bar -> 301 Location: https://<Host>/foo/bar - No Host header -> 301 Location: https://nishifamily.com/<path> V2 hook (D1.5): if path starts with /.well-known/acme-challenge/, serve the matching token from a config-driven directory instead of redirecting. Tracked as TODO in this file.

dependencies 3 imports · 0 importers

nx_syscalls.nx nx_http.nx nx_http_server.nx nx_pages_http_redirect.nx

imports: nx_syscalls.nxnx_http.nxnx_http_server.nx

imported by: nobody (leaf or entry point)

structs

none

consts

21const NX_MAGIC_2048: i64 = 2048
23const NX_REDIRECT_PORT: i64 = 80
24const NX_REDIRECT_BACKLOG: i64 = 64
25const NX_REDIRECT_REQ_CAP: i64 = 8192
26const NX_REDIRECT_OUT_CAP: i64 = 8192
28const NX_REDIRECT_OK: i64 = 0
29const NX_REDIRECT_ERR_LISTEN: i64 = 1
30const NX_REDIRECT_ERR_PARSE: i64 = 2

functions

36func _redirect_default_host() -> *u8 { return "nishifamily.com" as *u8 }
49func _build_301(
85func _redirect_serve_one(cfd: i64) -> i64
130func nx_pages_http_redirect_daemon_run() -> i64
151func main() -> i64