From 61ddf629acc2178791bcd4c557fe4e4c7a4914a0 Mon Sep 17 00:00:00 2001 From: Mathieu Gauthier-Pilote Date: Thu, 25 Jan 2024 14:23:27 -0500 Subject: [PATCH] CORS for xmpp-websocket in multidomain setup --- webapps/jitsimeet/templates/nginx/other.vhost.conf.j2 | 7 ++++--- webapps/jitsimeet/templates/nginx/vhost.conf.j2 | 1 + 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/webapps/jitsimeet/templates/nginx/other.vhost.conf.j2 b/webapps/jitsimeet/templates/nginx/other.vhost.conf.j2 index a897b8ab..472f8de0 100644 --- a/webapps/jitsimeet/templates/nginx/other.vhost.conf.j2 +++ b/webapps/jitsimeet/templates/nginx/other.vhost.conf.j2 @@ -105,7 +105,7 @@ server { proxy_pass http://prosody/room-info?prefix=$prefix&$args; proxy_http_version 1.1; proxy_set_header X-Forwarded-For $remote_addr; - proxy_set_header Host $http_host; + proxy_set_header Host {{ domains | first }}; } location ~ ^/_api/public/(.*)$ { @@ -130,17 +130,18 @@ server { proxy_pass http://$prosody_node/http-bind?prefix=$prefix&$args; proxy_http_version 1.1; proxy_set_header X-Forwarded-For $remote_addr; - proxy_set_header Host $http_host; + proxy_set_header Host {{ domains | first }}; proxy_set_header Connection ""; } # xmpp websockets location = /xmpp-websocket { + add_header 'Access-Control-Allow-Origin' '*'; proxy_pass http://$prosody_node/xmpp-websocket?prefix=$prefix&$args; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; - proxy_set_header Host $http_host; + proxy_set_header Host {{ domains | first }}; tcp_nodelay on; } diff --git a/webapps/jitsimeet/templates/nginx/vhost.conf.j2 b/webapps/jitsimeet/templates/nginx/vhost.conf.j2 index 1b2e6093..af8e79a1 100644 --- a/webapps/jitsimeet/templates/nginx/vhost.conf.j2 +++ b/webapps/jitsimeet/templates/nginx/vhost.conf.j2 @@ -153,6 +153,7 @@ server { # xmpp websockets location = /xmpp-websocket { + add_header 'Access-Control-Allow-Origin' '*'; proxy_pass http://$prosody_node/xmpp-websocket?prefix=$prefix&$args; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade;