Repository navigation
feat(venue): CORS on the info router (0.2.2) - #1
Merged
Merged
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 /infostraight from the page, so the browser sends a preflight first. The sim answeredOPTIONS /infowith405and never sentAccess-Control-Allow-Origin, so every browser call was blocked, while curl and the services worked.How
crates/venue/src/api/cors.rs, an axum middleware on the info router (/info,/exchange,/ws):OPTIONScarryingAccess-Control-Request-Method) is answered204with the allowed methods, the requested headers echoed back (content-typewhen none are named) and a 24h max age.Access-Control-Allow-Origin: *.Allow-Credentials: the port takes none.0.2.1to0.2.2(the staging image tag), withCargo.locktracking it.Tests
Three new tests cover the preflight, a normal answer and a plain
OPTIONS. The fulldiorama-venuesuite passes (165 tests), and clippy and rustfmt are clean on Rust 1.99.