Skip to content

Commit

Permalink
fix(Backend): 🐛 overwrite default option
Browse files Browse the repository at this point in the history
  • Loading branch information
Eason0729 committed Feb 9, 2024
1 parent 16ff382 commit 94f4147
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions backend/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use sea_orm::DatabaseConnection;
use spin::Mutex;
use tonic::transport::{self, Identity, ServerTlsConfig};
use tonic_web::GrpcWebLayer;
use tower_http::cors::CorsLayer;
use tower_http::cors::{AllowOrigin, Any, CorsLayer};
use tracing::{span, Instrument, Level};

use crate::{
Expand Down Expand Up @@ -101,7 +101,10 @@ impl Server {
}
/// Start the server
pub async fn start(self: Arc<Self>) {
let cors = CorsLayer::new().allow_headers([HeaderName::from_static("token")]);
let cors = CorsLayer::new()
.allow_headers([HeaderName::from_static("token")])
.allow_origin(AllowOrigin::mirror_request())
.allow_methods(Any);

let server = match self.identity.lock().take() {
Some(identity) => transport::Server::builder()
Expand Down

0 comments on commit 94f4147

Please sign in to comment.