hi everyone,
i have a question regarding the lib-jitsi-meet api and cross domain bosh.
i am self hosting a jitsi server on debian 11 with nginx and i am building a custom browser-UI using lib-jitsi-meet. the server is located on a different domain than the UI (the server is on jitsi.mydomain.com and the UI at mydomain.com). I have a server block configured for each domain.
my problem is that all of a sudden (after not touching either the server or the UI code for a week) i cannot connect to the server anymore via the api due to some CORS errors.
At first, I had simply set cross_domain_bosh = true in /etc/prosody/conf.avail/jitsi.mydomain.com.cfg.lua but this seems to have stopped working, so I followed the instructions here and here, but I am still getting these errors:
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://jitsi.mydomain.com/http-bind. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match ‘https://mydomain.com’).
(it is worth noting that the domain displayed here does match the one I specified in the config file)
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://jitsi.mydomain.com/http-bind. (Reason: CORS request did not succeed). Status code: (null).
2022-10-19T07:39:50.941Z [modules/xmpp/strophe.util.js] <6628/ca/mt.Strophe.log>: Strophe: request id 3.3 error 0 happened
I also tried updating prosody to version 0.12, but same story there. (i since downgraded again to 0.11.9). The only change I became aware of was that in version 0.12, the prosody log file suddenly stated that cross_domain_bosh was being deprecated. So as I said, I went back to my previous prosody version.
This is what I have set in /etc/nginx/sites-available/jitsi.mydomain.com.conf (I only included what I believe to be relevant for my problem)
ssi on; ssi_types application/x-javascript application/javascript; index index.html index.htm; error_page 404 /static/404.html; gzip on; gzip_types text/plain text/css application/javascript application/json imag> gzip_vary on; gzip_proxied no-cache no-store private expired auth; gzip_min_length 512; location = /config.js { alias /etc/jitsi/meet/jitsi.mydomain.com-config.js; } location = /external_api.js { alias /usr/share/jitsi-meet/libs/external_api.min.js; }
location = /_api/room-info {
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;
}# ensure all static content can always be found first location ~ ^/(libs|css|static|images|fonts|lang|sounds|connection_optimizat> { add_header 'Access-Control-Allow-Origin' '*'; alias /usr/share/jitsi-meet/$1/$2; # cache all versioned files if ($arg_v) { expires 1y; } } # BOSH
location = /http-bind {
proxy_pass http://localhost:5280;
# http://prosody/http-bind?prefix=$prefix&$args;
proxy_http_version 1.1;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header Host “jitsi.mydomain.com”;
# Host $http_host;
proxy_set_header Connection “”;
add_header ‘Access-Control-Allow-Origin’ “https://mydomain.com”;
add_header ‘Vary’ “Origin”;
}
and this is my config in /etc/prosody/conf.avail/jitsi.mydomain.com.cfg.lua
plugin_paths = { “/usr/share/jitsi-meet/prosody-plugins/” }
– domain mapper options, must at least have domain base set to use the mapper
muc_mapper_domain_base = “jitsi.mydomain.com”;external_service_secret = “mysecret”;
external_services = {
{ type = “stun”, host = “jitsi.mydomain.com”, port = 3478 },
{ type = “turn”, host = “jitsi.mydomain.com”, port = 3478, transport = “udp”, secret = true, ttl = 86400, algorithm = “turn” },>
{ type = “turns”, host = “jitsi.mydomain.com”, port = 5349, transpot = “tcp”, secret = true, ttl = 86400, algorithm = “turn” }};
– cross_domain_bosh = true;
consider_bosh_secure = true;asap_accepted_issuers = { “" };
asap_accepted_audiences = { "” };
I commented cross_domain_bosh = true; out because otherwhise I would get an error stating that multiple ‘Access-Control-Allow-Origin’ headers are not allowed.
Finally, this is my config in /etc/jitsi/meet/jitsi.mydomain.com-config.js
var subdir = ‘’;
var subdomain = ‘’;if (subdomain) {
subdomain = subdomain.substr(0, subdomain.length - 1).split(‘.’)
.join(‘_’)
.toLowerCase() + ‘.’;
}// In case of no ssi provided by the webserver, use empty strings
if (subdir.startsWith(‘<!–’)) {
subdir = ‘’;
}
if (subdomain.startsWith(‘<!–’)) {
subdomain = ‘’;
}var config = {
// Connection
//hosts: { // XMPP domain. domain: 'jitsi.mydomain.com', // XMPP MUC domain. FIXME: use XEP-0030 to discover it. muc: 'conference.' + subdomain + 'jitsi.mydomain.com', }, // BOSH URL. FIXME: use XEP-0156 to discover it. bosh: '//<!--# echo var="http_host" -->/<!--# echo var="subdir" default="" -->http-bind',
I would be so grateful for any hints on what could be going wrong!
have a good day everone!