nx_pages_http_redirect.nx
buildroot/runtime/nx_pages_http_redirect.nx
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
imports: nx_syscalls.nxnx_http.nxnx_http_server.nx
imported by: nobody (leaf or entry point)
structs
| none |
consts
| 21 | const NX_MAGIC_2048: i64 = 2048 |
| 23 | const NX_REDIRECT_PORT: i64 = 80 |
| 24 | const NX_REDIRECT_BACKLOG: i64 = 64 |
| 25 | const NX_REDIRECT_REQ_CAP: i64 = 8192 |
| 26 | const NX_REDIRECT_OUT_CAP: i64 = 8192 |
| 28 | const NX_REDIRECT_OK: i64 = 0 |
| 29 | const NX_REDIRECT_ERR_LISTEN: i64 = 1 |
| 30 | const NX_REDIRECT_ERR_PARSE: i64 = 2 |
functions
| 36 | func _redirect_default_host() -> *u8 { return "nishifamily.com" as *u8 } |
| 49 | func _build_301( |
| 85 | func _redirect_serve_one(cfd: i64) -> i64 |
| 130 | func nx_pages_http_redirect_daemon_run() -> i64 |
| 151 | func main() -> i64 |