Skip to content

Commit

Permalink
Merge pull request #286 from crabnebula-dev/feat/csp-any
Browse files Browse the repository at this point in the history
feat: allow accessing the instrumentation server on any URL
  • Loading branch information
lucasfernog-crabnebula authored May 22, 2024
2 parents 836ac88 + 6f4d151 commit b34c109
Showing 1 changed file with 2 additions and 8 deletions.
10 changes: 2 additions & 8 deletions crates/devtools-core/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ use devtools_wire_format::sources::sources_server::SourcesServer;
use devtools_wire_format::tauri::tauri_server;
use devtools_wire_format::tauri::tauri_server::TauriServer;
use futures::{FutureExt, TryStreamExt};
use http::HeaderValue;
use std::net::SocketAddr;
use tokio::sync::mpsc;
use tonic::codegen::http::Method;
Expand Down Expand Up @@ -55,13 +54,8 @@ impl Server {
let cors = CorsLayer::new()
// allow `GET` and `POST` when accessing the resource
.allow_methods([Method::GET, Method::POST])
.allow_headers(AllowHeaders::any());

let cors = if option_env!("__DEVTOOLS_LOCAL_DEVELOPMENT").is_some() {
cors.allow_origin(tower_http::cors::Any)
} else {
cors.allow_origin(HeaderValue::from_str("https://devtools.crabnebula.dev").unwrap())
};
.allow_headers(AllowHeaders::any())
.allow_origin(tower_http::cors::Any);

let router = tonic::transport::Server::builder()
.accept_http1(true)
Expand Down

0 comments on commit b34c109

Please sign in to comment.