From bff0416f0075d8ce8ac628c6c1a3f436120a0540 Mon Sep 17 00:00:00 2001 From: ppc Date: Sat, 21 Feb 2026 14:11:59 +0000 Subject: [PATCH] fix CORS issues due to missing header --- amnet-server/src/webserver.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/amnet-server/src/webserver.rs b/amnet-server/src/webserver.rs index 05dd729..fa914a4 100644 --- a/amnet-server/src/webserver.rs +++ b/amnet-server/src/webserver.rs @@ -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))