Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow all cors #79

Merged
merged 1 commit into from
Apr 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 4 additions & 11 deletions mpc-recovery/src/leader_node/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ use crate::transaction::{
get_add_key_delegate_action, get_create_account_delegate_action, get_signed_delegated_action,
};
use crate::NodeId;
use axum::http::HeaderValue;
use axum::{http::StatusCode, routing::post, Extension, Json, Router};
use futures::stream::FuturesUnordered;
use hyper::client::ResponseFuture;
Expand Down Expand Up @@ -72,17 +71,11 @@ pub async fn run(config: Config) {
account_creator_sk,
};

//TODO: now secure, allow only for testnet, whitelist for mainnet
let cors_layer = tower_http::cors::CorsLayer::new()
.allow_origin("http://localhost:3000".parse::<HeaderValue>().unwrap()) //TODO: now secure, allow only for testnet
.allow_origin(
"https://near-discovery-asq5uacgk-near-developer-console.vercel.app/"
.parse::<HeaderValue>()
.unwrap(),
)
.allow_origin("https://alpha.near.org/".parse::<HeaderValue>().unwrap())
.allow_origin("https://near.org/".parse::<HeaderValue>().unwrap())
.allow_methods([Method::POST])
.allow_headers(Any); // TODO: doublecheck what can be allowed here
.allow_origin(Any)
.allow_methods(Any)
.allow_headers(Any);

let app = Router::new()
.route("/submit", post(submit::<UniversalTokenVerifier>))
Expand Down