fix(control-api): enable CORS to allow UI access
This commit is contained in:
@@ -113,6 +113,11 @@ pub fn build_app(state: AppState) -> Router {
|
||||
.merge(documents::router())
|
||||
.layer(from_fn_with_state(state.clone(), auth::auth_middleware));
|
||||
|
||||
let cors = tower_http::cors::CorsLayer::new()
|
||||
.allow_origin(tower_http::cors::Any)
|
||||
.allow_methods(tower_http::cors::Any)
|
||||
.allow_headers(tower_http::cors::Any);
|
||||
|
||||
Router::new()
|
||||
.route("/health", get(health))
|
||||
.route("/ready", get(ready))
|
||||
@@ -123,6 +128,7 @@ pub fn build_app(state: AppState) -> Router {
|
||||
)
|
||||
.nest("/admin/v1", admin)
|
||||
.with_state(state)
|
||||
.layer(cors)
|
||||
.layer(trace)
|
||||
.layer(from_fn(request_id_middleware))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user