and it works for web calls. But for mobile apps(android/ios) it doesn’t work. I’ve set a hardcode value(jitsidev.mydomain.com) instead of ‘location.hostname’ and it worked with mobile app as well. But how can I put there a variable instead of direct value? I tried different variants like these:
This is server side include. You get the subdomain from the URL that hits nginx and set it as a variable and once config.js is ready to be served, those variables are replaced. You can do something similar in your nginx config for different domains.
Here how is prefix var set to empty string:
You can set your new var to your host and use it in the config.js
{{ if $ENABLE_XMPP_WEBSOCKET }}
# websockets for subdomains
location ~ ^/([^/?&:'"]+)/xmpp-websocket {
set $subdomain “$1.”;
set $subdir “$1/”;
set $prefix “$1”;
rewrite ^/(.*)$ /xmpp-websocket;
}
{{ end }}
config.js
var subdomain = <!--# echo var="subdomain" default="" -->;
var config = {
// Connection
//
hosts: {
// XMPP domain.
domain: 'meet.jitsi',
// When using authentication, domain for guest users.
// anonymousdomain: 'guest.example.com',
// Domain for authenticated users. Defaults to <domain>.
// authdomain: 'jitsi-meet.example.com',
// Focus component domain. Defaults to focus.<domain>.
// focus: 'focus.jitsi-meet.example.com',
// XMPP MUC domain. FIXME: use XEP-0030 to discover it.
muc: 'muc.meet.jitsi'
},
// BOSH URL. FIXME: use XEP-0156 to discover it.
bosh: '/http-bind',
// Websocket URL
websocket: 'wss://' + subdomain + '/xmpp-websocket',
Don’t touch existing ones, they already work. Subdomain is when you have Domain Registered at Safenames
.
Create a new one which is domain and is set with different value in your different nginx configs that handle different domains and use it in config.js so you will have same config.js for different domains.