Add serve --local for using the web page on this machine
CI / test (3.10) (push) Successful in 1m24s
CI / test (3.12) (push) Successful in 1m5s
CI / test (3.13) (push) Successful in 1m3s

The page is unreachable without nginx, since every route but /healthz
needs the X-Receipt-Token header it adds. `serve --local` serves it
without a token instead: it only binds to a loopback address and answers
only requests whose Host is localhost, 127.0.0.1 or ::1, so another site
can't reach it by DNS rebinding. POSTs still need the page header.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
2026-11-14 22:24:52 +00:00
co-authored by Claude Opus 5.5
parent ba92f1fbda
commit 0d4e2130a6
5 changed files with 91 additions and 14 deletions
+5
View File
@@ -752,6 +752,11 @@ def build_parser() -> argparse.ArgumentParser:
default=os.environ.get("RECEIPT_WEB_LISTEN", DEFAULT_WEB_LISTEN),
help=f"host:port to bind (default: {DEFAULT_WEB_LISTEN}, env RECEIPT_WEB_LISTEN)",
)
serve_p.add_argument(
"--local",
action="store_true",
help="Serve the page to a browser on this machine without the token (localhost only)",
)
return parser