mirror of
https://gitea.tendokyu.moe/ppc/amnet.git
synced 2026-10-05 21:28:08 +03:00
fix CORS issues due to missing header
This commit is contained in:
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user