Add serve --local for using the web page on this machine
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:
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user