Before a fetch
is sent, the browser will send a request method OPTIONS
to confirm that the API will accept the request from a script with a particular origin.
Chrome shows that the my Axum server is rejecting my client's request with 405. My router looks something like this:
let app = Router::new()
.layer(TraceLayer::new_for_http())
.layer(CorsLayer::permissive())
.route("/api", post(server));
Router::layer says All requests to the router will be processed by the layer’s corresponding middleware. but I'm not sure its doing its job.