cors, nginx (still not working)

This commit is contained in:
Brandon Thomas committed 2022-02-27 06:37:40 -05:00
1 parent c44dc209b3
commit 7b7417ae14
3 files changed
+48 -9

No files matched your search

+14 -5
View File
@@ -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")
@@ -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
})
}
+31 -1
View File
@@ -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;
}
}