Skip to content

Commit 1a15427

Browse files
committed
chore: remove cors limitations
1 parent 8a84199 commit 1a15427

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/main.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use axum::http::{HeaderValue, Method};
33
use sqlx::PgPool;
44
use std::sync::Arc;
55
use time::UtcOffset;
6-
use tower_http::cors::CorsLayer;
6+
use tower_http::cors::{Any, CorsLayer};
77
use tracing::info;
88
use tracing_subscriber::{fmt, layer::SubscriberExt, util::SubscriberInitExt, EnvFilter};
99

@@ -138,13 +138,14 @@ fn build_graphql_schema(
138138

139139
fn setup_cors() -> CorsLayer {
140140
// TODO: Replace hardcoded strings
141-
let origins: [HeaderValue; 2] = [
141+
let _origins: [HeaderValue; 2] = [
142142
"http://127.0.0.1:3000".parse().unwrap(),
143143
"https://home.amfoss.in".parse().unwrap(),
144144
];
145145

146146
CorsLayer::new()
147-
.allow_origin(origins)
147+
// TODO 2: https://github.com/amfoss/root/issues/151, enabling all origins for the time being
148+
.allow_origin(Any)
148149
.allow_methods([Method::GET, Method::POST, Method::OPTIONS])
149150
.allow_headers(tower_http::cors::Any)
150151
}

0 commit comments

Comments
 (0)