diff --git a/debian/jitsi-meet-web-config.postinst b/debian/jitsi-meet-web-config.postinst index 900080e1ab..662b96bbee 100644 --- a/debian/jitsi-meet-web-config.postinst +++ b/debian/jitsi-meet-web-config.postinst @@ -99,6 +99,8 @@ case "$1" in JITSI_MEET_CONFIG="/etc/jitsi/meet/$JVB_HOSTNAME-config.js" if [ ! -f $JITSI_MEET_CONFIG ] ; then cp /usr/share/jitsi-meet-web-config/config.js $JITSI_MEET_CONFIG + # replaces needed config for multidomain as it works only with nginx + sed -i "s/conference.jitsi-meet.example.com/conference.<\!--# echo var=\"subdomain\" default=\"\" -->jitsi-meet.example.com/g" $JITSI_MEET_CONFIG sed -i "s/jitsi-meet.example.com/$JVB_HOSTNAME/g" $JITSI_MEET_CONFIG fi diff --git a/doc/debian/jitsi-meet-prosody/prosody.cfg.lua-jvb.example b/doc/debian/jitsi-meet-prosody/prosody.cfg.lua-jvb.example index 87653af826..252d4d9973 100644 --- a/doc/debian/jitsi-meet-prosody/prosody.cfg.lua-jvb.example +++ b/doc/debian/jitsi-meet-prosody/prosody.cfg.lua-jvb.example @@ -1,5 +1,8 @@ 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 = "jitmeet.example.com"; + VirtualHost "jitmeet.example.com" -- enabled = false -- Remove this line to enable this host authentication = "anonymous" @@ -28,6 +31,7 @@ Component "conference.jitmeet.example.com" "muc" storage = "null" modules_enabled = { "muc_meeting_id"; + "muc_domain_mapper"; -- "token_verification"; } admins = { "focusUser@auth.jitmeet.example.com" } diff --git a/doc/debian/jitsi-meet/jitsi-meet.example b/doc/debian/jitsi-meet/jitsi-meet.example index a4803259b7..bd743d5882 100644 --- a/doc/debian/jitsi-meet/jitsi-meet.example +++ b/doc/debian/jitsi-meet/jitsi-meet.example @@ -19,7 +19,11 @@ server { ssl_certificate_key /etc/jitsi/meet/jitsi-meet.example.com.key; root /usr/share/jitsi-meet; + + # ssi on with javascript for multidomain variables in config.js ssi on; + ssi_types application/x-javascript application/javascript; + index index.html index.htm; error_page 404 /static/404.html; @@ -52,4 +56,28 @@ server { location @root_path { rewrite ^/(.*)$ / break; } + + location ~ ^/([^/?&:'"]+)/config.js$ + { + set $subdomain "$1."; + set $subdir "$1/"; + + alias /etc/jitsi/meet/jitsi-meet.example.com-config.js; + } + + #Anything that didn't match above, and isn't a real file, assume it's a room name and redirect to / + location ~ ^/([^/?&:'"]+)/(.*)$ { + set $subdomain "$1."; + set $subdir "$1/"; + rewrite ^/([^/?&:'"]+)/(.*)$ /$2; + } + + # BOSH for subdomains + location ~ ^/([^/?&:'"]+)/http-bind { + set $subdomain "$1."; + set $subdir "$1/"; + set $prefix "$1"; + + rewrite ^/(.*)$ /http-bind; + } } diff --git a/doc/example-config-files/multidomain/jitsi.example.com.multidomain.example b/doc/example-config-files/multidomain/jitsi.example.com.multidomain.example index 0d190ded84..dc579fe6d2 100644 --- a/doc/example-config-files/multidomain/jitsi.example.com.multidomain.example +++ b/doc/example-config-files/multidomain/jitsi.example.com.multidomain.example @@ -36,10 +36,6 @@ server { rewrite ^/(.*)$ / break; } - location / { - ssi on; - } - location ~ ^/([^/?&:'"]+)/config.js$ { set $subdomain "$1."; @@ -64,4 +60,4 @@ server { rewrite ^/(.*)$ /http-bind; } -} \ No newline at end of file +} diff --git a/doc/example-config-files/multidomain/prosody.cfg.multidomain.example b/doc/example-config-files/multidomain/prosody.cfg.multidomain.example index b2185530b0..2653315fb1 100644 --- a/doc/example-config-files/multidomain/prosody.cfg.multidomain.example +++ b/doc/example-config-files/multidomain/prosody.cfg.multidomain.example @@ -83,8 +83,6 @@ modules_enabled = { "adhoc"; "websocket"; "http_altconnect"; - -- include domain mapper as global level module - "muc_domain_mapper"; } -- domain mapper options, must at least have domain base set to use the mapper diff --git a/resources/prosody-plugins/mod_muc_domain_mapper.lua b/resources/prosody-plugins/mod_muc_domain_mapper.lua index 1a4a045b86..07aa5ac3cf 100644 --- a/resources/prosody-plugins/mod_muc_domain_mapper.lua +++ b/resources/prosody-plugins/mod_muc_domain_mapper.lua @@ -1,8 +1,6 @@ -- Maps MUC JIDs like room1@muc.foo.example.com to JIDs like [foo]room1@muc.example.com -- Must be loaded on the client host in Prosody -module:set_global(); - -- It is recommended to set muc_mapper_domain_base to the main domain being served (example.com) local jid = require "util.jid"; @@ -13,7 +11,7 @@ local muc_domain_prefix = module:get_option_string("muc_mapper_domain_prefix", " local muc_domain_base = module:get_option_string("muc_mapper_domain_base"); if not muc_domain_base then - module:log("warn", "No 'muc_domain_base' option set, disabling muc_mapper plugin inactive"); + module:log("warn", "No 'muc_mapper_domain_base' option set, disabling muc_mapper plugin inactive"); return end @@ -116,14 +114,14 @@ end function module.load() if module.reloading then module:log("debug", "Reloading MUC mapper!"); - else + else module:log("debug", "First load of MUC mapper!"); end filters.add_filter_hook(filter_session); end function module.unload() - filters.remove_filter_hook(filter_session); + filters.remove_filter_hook(filter_session); end @@ -150,10 +148,14 @@ local function hook_all_stanzas(handler, host_module, event_prefix) end end - -function module.add_host(host_module) - module:log("info", - "Loading mod_muc_domain_mapper for host %s!", host_module.host); +function add_host(host) + module:log("info", "Loading mod_muc_domain_mapper for host %s!", host); + local host_module = module:context(host); hook_all_stanzas(incoming_stanza_rewriter, host_module); hook_all_stanzas(outgoing_stanza_rewriter, host_module, "pre-"); end + +prosody.events.add_handler("host-activated", add_host); +for host in pairs(prosody.hosts) do + add_host(host); +end