Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3536745
D12719.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D12719.diff
View Options
diff --git a/Cargo.lock b/Cargo.lock
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -2902,6 +2902,7 @@
"tonic 0.9.2",
"tonic-build 0.9.2",
"tonic-web",
+ "tower",
"tower-http",
"tracing",
"tracing-subscriber",
diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -100,3 +100,4 @@
url = "2.5"
uuid = "1.3"
wasm-bindgen = "0.2"
+tower = "0.4"
diff --git a/services/identity/Cargo.toml b/services/identity/Cargo.toml
--- a/services/identity/Cargo.toml
+++ b/services/identity/Cargo.toml
@@ -42,6 +42,7 @@
reqwest = { workspace = true, features = ["json", "rustls-tls"] }
futures = { workspace = true }
url = { workspace = true }
+tower = { workspace = true }
[build-dependencies]
tonic-build = "0.9.1"
diff --git a/services/identity/src/constants.rs b/services/identity/src/constants.rs
--- a/services/identity/src/constants.rs
+++ b/services/identity/src/constants.rs
@@ -310,11 +310,12 @@
pub const DEFAULT_MAX_AGE: Duration = Duration::from_secs(24 * 60 * 60);
pub const DEFAULT_EXPOSED_HEADERS: [&str; 3] =
["grpc-status", "grpc-message", "grpc-status-details-bin"];
- pub const DEFAULT_ALLOW_HEADERS: [&str; 11] = [
+ pub const DEFAULT_ALLOW_HEADERS: [&str; 12] = [
"x-grpc-web",
"content-type",
"x-user-agent",
"grpc-timeout",
+ "authorization",
super::request_metadata::CODE_VERSION,
super::request_metadata::STATE_VERSION,
super::request_metadata::MAJOR_DESKTOP_VERSION,
diff --git a/services/identity/src/websockets/mod.rs b/services/identity/src/websockets/mod.rs
--- a/services/identity/src/websockets/mod.rs
+++ b/services/identity/src/websockets/mod.rs
@@ -15,6 +15,7 @@
};
use serde::{Deserialize, Serialize};
use tokio::net::TcpListener;
+use tower::ServiceBuilder;
use tracing::{debug, error, info, warn};
mod auth;
@@ -26,6 +27,7 @@
error_types, IDENTITY_SEARCH_INDEX, IDENTITY_SEARCH_RESULT_SIZE,
IDENTITY_SERVICE_WEBSOCKET_ADDR, SOCKET_HEARTBEAT_TIMEOUT,
};
+use crate::cors::cors_layer;
use opensearch::OpenSearchResponse;
use send::{send_message, WebsocketSink};
pub mod errors;
@@ -108,7 +110,12 @@
while let Ok((stream, addr)) = listener.accept().await {
let db_client = db_client.clone();
let connection = http
- .serve_connection(stream, WebsocketService { addr, db_client })
+ .serve_connection(
+ stream,
+ ServiceBuilder::new()
+ .layer(cors_layer())
+ .service(WebsocketService { addr, db_client }),
+ )
.with_upgrades();
tokio::spawn(async move {
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Thu, Dec 26, 6:49 PM (11 h, 8 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2708162
Default Alt Text
D12719.diff (2 KB)
Attached To
Mode
D12719: Fix CORS issues with identity HTTP
Attached
Detach File
Event Timeline
Log In to Comment