fix CORS issues due to missing header

This commit is contained in:
ppc
2026-02-21 14:18:39 +00:00
parent 701a92dea5
commit bff0416f00
+2 -2
View File
@@ -1,6 +1,6 @@
use std::time::{Duration, Instant};
use axum::http::{StatusCode, header};
use axum::http::{Method, StatusCode, header};
use axum::response::{IntoResponse, Response};
use axum::routing::{get, post};
use axum::{Json, Router};
@@ -16,7 +16,7 @@ use crate::webapi::API_VERSION;
pub fn build_server() -> Router {
let services = ServiceBuilder::new()
.layer(TraceLayer::new_for_http())
.layer(CorsLayer::new().allow_origin(Any).allow_methods(Any));
.layer(CorsLayer::new().allow_origin(Any).allow_headers(Any).allow_methods([Method::GET, Method::POST]).max_age(Duration::from_secs(600)));
Router::<()>::new()
.route("/amnet/info", get(server_state_handler))