pub fn cors_allowing<I, S>(origins: I) -> CorsLayerExpand description
Build a CORS layer that allows the given origins.
Allows the common REST methods (GET, POST, PUT, PATCH, DELETE, OPTIONS), the
content-type and authorization request headers, and credentials. Origins that fail to
parse as header values are skipped. Requires the cors feature.
ยงExample
use axum::{routing::get, Router};
use axum_api_kit::cors_allowing;
let app: Router = Router::new()
.route("/", get(|| async { "ok" }))
.layer(cors_allowing(["https://app.example.com"]));