Skip to content

feat(venue): CORS on the info router (0.2.2) - #1

Merged
piterxyz merged 1 commit into
HerodotusDev:developfrom
piterxyz:venue-cors
Nov 16, 2026
Merged

piterxyz merged 1 commit into
HerodotusDev:developfrom
piterxyz:venue-cors

Conversation

@piterxyz

Copy link
Copy Markdown

What

Adds CORS to the venue-sim info router (port 8090) and bumps the workspace to 0.2.2.

Why

The consumer web app posts JSON to POST /info straight from the page, so the browser sends a preflight first. The sim answered OPTIONS /info with 405 and never sent Access-Control-Allow-Origin, so every browser call was blocked, while curl and the services worked.

How

  • New crates/venue/src/api/cors.rs, an axum middleware on the info router (/info, /exchange, /ws):
    • A preflight (an OPTIONS carrying Access-Control-Request-Method) is answered 204 with the allowed methods, the requested headers echoed back (content-type when none are named) and a 24h max age.
    • Every other response gets Access-Control-Allow-Origin: *.
    • No Allow-Credentials: the port takes none.
  • The control router is unchanged and stays closed to browsers.
  • Workspace version 0.2.1 to 0.2.2 (the staging image tag), with Cargo.lock tracking it.

Tests

Three new tests cover the preflight, a normal answer and a plain OPTIONS. The full diorama-venue suite passes (165 tests), and clippy and rustfmt are clean on Rust 1.99.

The consumer's web app posts JSON to /info straight from the page, which
makes the browser send a preflight first. The sim answered it with 405 and
no allow-origin header, so every browser call was blocked while curl and the
services worked. The info router now answers a preflight (204, echoing the
requested headers) and gives every response Access-Control-Allow-Origin: *,
like the venue it mirrors. No credentials are allowed, and the control
router stays closed to browsers.

Bump the workspace version to 0.2.2 (the image tag the staging pipeline
derives), with Cargo.lock tracking it.
@piterxyz
piterxyz merged commit 039eb81 into HerodotusDev:develop Nov 16, 2026
1 check passed
@piterxyz
piterxyz deleted the venue-cors branch November 16, 2026 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant