diff --git a/crates/lib/http_server_common/src/cors.rs b/crates/lib/http_server_common/src/cors.rs index e0eada1edc..19aafcef3c 100644 --- a/crates/lib/http_server_common/src/cors.rs +++ b/crates/lib/http_server_common/src/cors.rs @@ -5,11 +5,7 @@ use actix_http::http; /// Return cors config for FakeYou / Vocodes / OBS / local development pub fn build_common_cors_config() -> Cors { Cors::default() - // Local Development - .allowed_origin("http://api.jungle.horse") - .allowed_origin("http://jungle.horse") - .allowed_origin("http://jungle.horse:12345") - .allowed_origin("http://jungle.horse:7000") + // Local Development (Localhost) .allowed_origin("http://localhost:12345") .allowed_origin("http://localhost:3000") .allowed_origin("http://localhost:54321") @@ -26,8 +22,17 @@ pub fn build_common_cors_config() -> Cors { .allowed_origin("http://localhost:7009") .allowed_origin("http://localhost:8000") .allowed_origin("http://localhost:8080") + // Local Development (JungleHorse) + .allowed_origin("http://api.jungle.horse") + .allowed_origin("http://jungle.horse") + .allowed_origin("http://jungle.horse:12345") + .allowed_origin("http://jungle.horse:7000") + .allowed_origin("http://obs.jungle.horse") + .allowed_origin("http://ws.jungle.horse") .allowed_origin("https://api.jungle.horse") .allowed_origin("https://jungle.horse") + .allowed_origin("https://obs.jungle.horse") + .allowed_origin("https://ws.jungle.horse") // FakeYou .allowed_origin("http://api.fakeyou.com") .allowed_origin("http://fakeyou.com") @@ -35,9 +40,13 @@ pub fn build_common_cors_config() -> Cors { .allowed_origin("https://fakeyou.com") // Storyteller .allowed_origin("http://api.storyteller.io") + .allowed_origin("http://obs.storyteller.io") .allowed_origin("http://storyteller.io") + .allowed_origin("http://ws.storyteller.io") .allowed_origin("https://api.storyteller.io") + .allowed_origin("https://obs.storyteller.io") .allowed_origin("https://storyteller.io") + .allowed_origin("https://ws.storyteller.io") // Trumped (legacy) .allowed_origin("http://trumped.com") .allowed_origin("https://trumped.com") diff --git a/crates/service/websocket_gateway/src/endpoints_ws/obs_gateway_websocket_handler.rs b/crates/service/websocket_gateway/src/endpoints_ws/obs_gateway_websocket_handler.rs index 1187208e6b..7df0547faf 100644 --- a/crates/service/websocket_gateway/src/endpoints_ws/obs_gateway_websocket_handler.rs +++ b/crates/service/websocket_gateway/src/endpoints_ws/obs_gateway_websocket_handler.rs @@ -115,8 +115,6 @@ pub async fn obs_gateway_websocket_handler( CommonServerError::ServerError })?; - info!("Begin Javascript WebSocket..."); - let server_state_arc = server_state.get_ref().clone(); let websocket = ObsGatewayWebSocket::new( @@ -124,9 +122,11 @@ pub async fn obs_gateway_websocket_handler( server_state_arc ); + info!("Begin Javascript WebSocket..."); + ws::start(websocket, &http_request, stream) .map_err(|e| { - warn!("Websocket error: {}", e); + warn!("Websocket ws::start() error: {}", e); CommonServerError::ServerError }) } diff --git a/localdev/nginx-http-config/storyteller-ssl b/localdev/nginx-http-config/storyteller-ssl index 305753808b..68fb8d9b24 100644 --- a/localdev/nginx-http-config/storyteller-ssl +++ b/localdev/nginx-http-config/storyteller-ssl @@ -89,6 +89,21 @@ server { } } +# Websocket API backend over SSL +server { + listen 443 ssl; + listen [::]:443 ssl; + ssl_certificate /etc/ssl/certs/localhost.crt; + ssl_certificate_key /etc/ssl/private/localhost.key; + ssl_protocols TLSv1.2 TLSv1.1 TLSv1; + server_name ws.jungle.horse; + location / { + proxy_set_header Host $host; + proxy_pass http://127.0.0.1:54321; + proxy_redirect off; + } +} + # Javascript frontend over plain HTTP server { listen 80; @@ -107,7 +122,7 @@ server { server_name obs.jungle.horse; location / { proxy_set_header Host $host; - proxy_pass http://127.0.0.1:7001; + proxy_pass http://127.0.0.1:7007; proxy_redirect off; } } @@ -126,3 +141,18 @@ server { proxy_redirect off; } } + +# Javascript frontend over SSL (OBS Layer) +server { + listen 443 ssl; + listen [::]:443 ssl; + ssl_certificate /etc/ssl/certs/localhost.crt; + ssl_certificate_key /etc/ssl/private/localhost.key; + ssl_protocols TLSv1.2 TLSv1.1 TLSv1; + server_name obs.jungle.horse; + location / { + proxy_set_header Host $host; + proxy_pass http://127.0.0.1:7007; + proxy_redirect off; + } +}