diff --git a/mono/src/server/https_server.rs b/mono/src/server/https_server.rs index 5de3f7ea6..3b16737c7 100644 --- a/mono/src/server/https_server.rs +++ b/mono/src/server/https_server.rs @@ -10,7 +10,6 @@ use axum::http::{self, Request, Uri}; use axum::response::Response; use axum::routing::get; use axum::Router; -use http::HeaderValue; use lazy_static::lazy_static; use regex::Regex; use tower::ServiceBuilder; @@ -100,7 +99,6 @@ pub async fn app(context: Context, host: String, port: u16) -> Router { listen_addr: format!("http://{}:{}", host, port), }; - let cors_origin = HeaderValue::from_str(&config.oauth.clone().unwrap().ui_domain).expect("ui_domain in config not set"); // add RequestDecompressionLayer for handle gzip encode // add TraceLayer for log record // add CorsLayer to add cors header @@ -114,9 +112,15 @@ pub async fn app(context: Context, host: String, port: u16) -> Router { // Using Regular Expressions for Path Matching in Protocol .route("/{*path}", get(get_method_router).post(post_method_router)) .layer( - ServiceBuilder::new().layer(CorsLayer::new().allow_origin(cors_origin).allow_headers( - vec![http::header::AUTHORIZATION, http::header::CONTENT_TYPE], - ).allow_methods(Any)), + ServiceBuilder::new().layer( + CorsLayer::new() + .allow_origin(Any) + .allow_headers(vec![ + http::header::AUTHORIZATION, + http::header::CONTENT_TYPE, + ]) + .allow_methods(Any), + ), ) .layer(TraceLayer::new_for_http()) .layer(RequestDecompressionLayer::new())