Docker multidomain setup

Hi there I am trying to setup multi tenant configuration in my local docker setup. I followed
https://github.com/jitsi/docker-jitsi-meet#quick-start
After enabled the muc_comain_mapper and added subdomain configs to web service.
But when i try to create a conference eg. https://localhost:8443/tenant1/room1
i get an error. So i looked into the logs. Prosody Debug logs;

mod_s2s                                                      debug	stanza [iq] queued until connection complete
muc.meet.jitsi:muc_domain_mapper                             warn	Session filters applied
s2sout5602ef857860                                           debug	First attempt to connect to muc.tenant1.meet.jitsi, starting with SRV lookup...
adns                                                         debug	Records for _xmpp-server._tcp.muc.tenant1.meet.jitsi. not in cache, sending query (thread: 0x5602ef8593f0)...
server_epoll                                                 debug	Watching FD 16 (dns, 53, 0.0.0.0, 0)
adns                                                         debug	Sending DNS query to 127.0.0.11
server_epoll                                                 debug	Close FD 16 (dns, 53, 0.0.0.0, 0) now
server_epoll                                                 debug	Unwatched FD 16 (dns, 53, 0.0.0.0, 0)
adns                                                         debug	Reply for _xmpp-server._tcp.muc.tenant1.meet.jitsi. (thread: 0x5602ef8593f0)
s2sout5602ef857860                                           debug	muc.tenant1.meet.jitsi has no SRV records, falling back to A/AAAA
adns                                                         debug	Records for muc.tenant1.meet.jitsi not in cache, sending query (thread: 0x5602ef85dfb0)...
server_epoll                                                 debug	Watching FD 16 (dns, 53, 0.0.0.0, 0)
adns                                                         debug	Sending DNS query to 127.0.0.11
server_epoll                                                 debug	Close FD 16 (dns, 53, 0.0.0.0, 0) now
server_epoll                                                 debug	Unwatched FD 16 (dns, 53, 0.0.0.0, 0)
adns                                                         debug	Reply for muc.tenant1.meet.jitsi (thread: 0x5602ef85dfb0)
s2sout5602ef857860                                           debug	DNS lookup failed to get a response for muc.tenant1.meet.jitsi
s2sout5602ef857860                                           info	Failed in all attempts to connect to muc.tenant1.meet.jitsi
s2sout5602ef857860                                           debug	No other records to try for muc.tenant1.meet.jitsi - destroying
s2sout5602ef857860                                           debug	Destroying outgoing session auth.meet.jitsi->muc.tenant1.meet.jitsi: DNS resolution failed
s2sout5602ef857860                                           info	Sending error replies for 1 queued stanzas because of failed outgoing connection to muc.tenant1.meet.jitsi
stanzarouter                                                 debug	Received[s2sin]: <iq to='focus@auth.meet.jitsi/focus77859502645863' from='muc.tenant1.meet.jitsi' id='gi0m9-458' type='error'>
c2s5602ef14acc0                                              debug	Sending[c2s]: <iq to='focus@auth.meet.jitsi/focus77859502645863' from='muc.tenant1.meet.jitsi' id='gi0m9-458' type='error'>
muc.meet.jitsi:muc_domain_mapper                             debug	Filtering stanza type iq  to focus@auth.meet.jitsi/focus77859502645863 from muc.tenant1.meet.jitsi
muc.meet.jitsi:muc_domain_mapper                             debug	No need to rewrite out 'to' focus@auth.meet.jitsi/focus77859502645863
muc.meet.jitsi:muc_domain_mapper                             debug	No need to rewrite muc.tenant1.meet.jitsi (not from the MUC host) gi0m9-458, <nil>
jcp5602ef43a690                                              debug	Received[component]: <iq to='dru0mx5x3mz7bte_@meet.jitsi/iFpJmEWB' id='268e1b67-9503-4abd-9d4d-06790acc8c4e:sendIQ' from='focus.meet.jitsi' type='error'>

Thanks in advance!

My config files;

Prosody:

admins = { "focus@auth.meet.jitsi" }
plugin_paths = { "/prosody-plugins/", "/prosody-plugins-custom" }
http_default_host = "meet.jitsi"

muc_mapper_domain_base = "meet.jitsi";

cross_domain_bosh = false;
consider_bosh_secure = true;

VirtualHost "meet.jitsi"

    authentication = "anonymous"

    ssl = {
        key = "/config/certs/meet.jitsi.key";
        certificate = "/config/certs/meet.jitsi.crt";
    }
    modules_enabled = {
        "bosh";
        "pubsub";
        "ping";
        "speakerstats";
        "conference_duration";
        
        
    }

    speakerstats_component = "speakerstats.meet.jitsi"
    conference_duration_component = "conferenceduration.meet.jitsi"

    c2s_require_encryption = false



VirtualHost "auth.meet.jitsi"
    ssl = {
        key = "/config/certs/auth.meet.jitsi.key";
        certificate = "/config/certs/auth.meet.jitsi.crt";
    }
    authentication = "internal_hashed"


VirtualHost "recorder.meet.jitsi"
    modules_enabled = {
      "ping";
    }
    authentication = "internal_hashed"


Component "internal-muc.meet.jitsi" "muc"
    modules_enabled = {
        "ping";
        
    }
    storage = "memory"
    muc_room_cache_size = 1000

Component "muc.meet.jitsi" "muc"
    storage = "memory"
    modules_enabled = {
        "muc_meeting_id";
        "muc_domain_mapper";
        -- "token_verification";
    }
    muc_room_locking = false
    muc_room_default_public_jids = true

Component "focus.meet.jitsi"
    component_secret = "aa94239c593ca814150a4763b113350e"

Component "speakerstats.meet.jitsi" "speakerstats_component"
    muc_component = "muc.meet.jitsi"

Component "conferenceduration.meet.jitsi" "conference_duration_component"
    muc_component = "muc.meet.jitsi"

Nginx meet.conf

server_name _;

client_max_body_size 0;

root /usr/share/jitsi-meet;

ssi on;
ssi_types application/x-javascript application/javascript;
set $prefix "";

index index.html index.htm;
error_page 404 /static/404.html;

gzip on;
gzip_types text/plain text/css application/javascript application/json;
gzip_vary on;

location = /config.js {
    alias /config/config.js;
}

location = /interface_config.js {
    alias /config/interface_config.js;
}

location = /external_api.js {
    alias /usr/share/jitsi-meet/libs/external_api.min.js;
}

#ensure all static content can always be found first
location ~ ^/(libs|css|static|images|fonts|lang|sounds|connection_optimization|.well-known)/(.*)$
{
    add_header 'Access-Control-Allow-Origin' '*';
    alias /usr/share/jitsi-meet/$1/$2;
}

# BOSH
location = /http-bind {
    proxy_pass  http://xmpp.meet.jitsi:5280/http-bind;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $http_host;
}

# xmpp websockets
location = /xmpp-websocket {
    proxy_pass http://xmpp.meet.jitsi:5280/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;
    tcp_nodelay on;
}

location ~ ^/([^/?&:'"]+)$ {
    try_files $uri @root_path;
}

location @root_path {
    rewrite ^/(.*)$ / break;
}

location ~ ^/([^/?&:'"]+)/config.js$
{
   set $subdomain "$1.";
   set $subdir "$1/";

   alias /config/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;
}

# websockets for subdomains
location ~ ^/([^/?&:'"]+)/xmpp-websocket {
    set $subdomain "$1.";
    set $subdir "$1/";
    set $prefix "$1";

    rewrite ^/(.*)$ /xmpp-websocket;
}

Solved. Turns out in order to muc domain mapper to work muc address should start with “conference” as in my config it was “muc”

@Suleyman_Sahin Can you please share your prosody config?

I tried your fix but it didn’t work for me

jitsi-meet.cfg.lua

admins = {
    "{{ .Env.JICOFO_AUTH_USER }}@{{ .Env.XMPP_AUTH_DOMAIN }}",
    "{{ .Env.JVB_AUTH_USER }}@{{ .Env.XMPP_AUTH_DOMAIN }}"
}

plugin_paths = { "/prosody-plugins/", "/prosody-plugins-custom" }
http_default_host = "{{ .Env.XMPP_DOMAIN }}"
muc_mapper_domain_base = "{{ .Env.XMPP_DOMAIN }}"
--trusted_proxies = { "172.28.1.1" }
consider_websocket_secure = true
cross_domain_websocket = true

{{ $ENABLE_AUTH := .Env.ENABLE_AUTH | default "0" | toBool }}
{{ $ENABLE_GUEST_DOMAIN := and $ENABLE_AUTH (.Env.ENABLE_GUESTS | default "0" | toBool)}}
{{ $AUTH_TYPE := .Env.AUTH_TYPE | default "internal" }}
{{ $JWT_ASAP_KEYSERVER := .Env.JWT_ASAP_KEYSERVER | default "" }}
{{ $JWT_ALLOW_EMPTY := .Env.JWT_ALLOW_EMPTY | default "0" | toBool }}
{{ $JWT_AUTH_TYPE := .Env.JWT_AUTH_TYPE | default "token" }}
{{ $JWT_TOKEN_AUTH_MODULE := .Env.JWT_TOKEN_AUTH_MODULE | default "token_verification" }}
{{ $ENABLE_LOBBY := .Env.ENABLE_LOBBY | default "0" | toBool }}
{{ $WEBSOCKETS := .Env.ENABLE_WEBSOCKETS | default "false" }}
{{ $ENABLE_SUBDOMAINS := .Env.ENABLE_SUBDOMAINS | default "false" }}

{{ if and $ENABLE_AUTH (eq $AUTH_TYPE "jwt") .Env.JWT_ACCEPTED_ISSUERS }}
asap_accepted_issuers = { "{{ join "\",\"" (splitList "," .Env.JWT_ACCEPTED_ISSUERS) }}" }
{{ end }}

{{ if and $ENABLE_AUTH (eq $AUTH_TYPE "jwt") .Env.JWT_ACCEPTED_AUDIENCES }}
asap_accepted_audiences = { "{{ join "\",\"" (splitList "," .Env.JWT_ACCEPTED_AUDIENCES) }}" }
{{ end }}

VirtualHost "{{ .Env.XMPP_DOMAIN }}"
{{ if $ENABLE_AUTH }}
  {{ if eq $AUTH_TYPE "jwt" }}
    authentication = "{{ $JWT_AUTH_TYPE }}"
    app_id = "{{ .Env.JWT_APP_ID }}"
    app_secret = "{{ .Env.JWT_APP_SECRET }}"
    allow_empty_token = {{ if $JWT_ALLOW_EMPTY }}true{{ else }}false{{ end }}
    {{ if $JWT_ASAP_KEYSERVER }}
    asap_key_server = "{{ .Env.JWT_ASAP_KEYSERVER }}"
    {{ end }}

    {{ else if eq $AUTH_TYPE "ldap" }}
    authentication = "cyrus"
    cyrus_application_name = "xmpp"
    allow_unencrypted_plain_auth = true
  {{ else if eq $AUTH_TYPE "internal" }}
    authentication = "internal_hashed"
  {{ end }}
{{ else }}
    authentication = "anonymous"
{{ end }}
    ssl = {
        key = "/config/certs/{{ .Env.XMPP_DOMAIN }}.key";
        certificate = "/config/certs/{{ .Env.XMPP_DOMAIN }}.crt";
    }
    modules_enabled = {
        "websocket";
        "bosh";
        "pubsub";
        "ping";
        "speakerstats";
        "conference_duration";
        {{ if and $ENABLE_LOBBY (not $ENABLE_GUEST_DOMAIN) }}
        "muc_lobby_rooms";
        {{ end }}
        {{ if .Env.XMPP_MODULES }}
        "{{ join "\";\n\"" (splitList "," .Env.XMPP_MODULES) }}";
        {{ end }}
        {{ if and $ENABLE_AUTH (eq $AUTH_TYPE "ldap") }}
        "auth_cyrus";
        {{end}}
        {{ if .Env.ENABLE_RECORDING }}
        "allow_jibri_tobypass";
        {{ end }}
        {{ if eq $WEBSOCKETS "true" }}
        "smacks";
        {{ end }}

    }

    {{ if and $ENABLE_LOBBY (not $ENABLE_GUEST_DOMAIN) }}
    main_muc = "{{ .Env.XMPP_MUC_DOMAIN }}"
    lobby_muc = "lobby.{{ .Env.XMPP_DOMAIN }}"
    {{ if .Env.XMPP_RECORDER_DOMAIN }}
    muc_lobby_whitelist = { "{{ .Env.XMPP_RECORDER_DOMAIN }}" }
    {{ end }}
    {{ end }}

    speakerstats_component = "speakerstats.{{ .Env.XMPP_DOMAIN }}"
    conference_duration_component = "conferenceduration.{{ .Env.XMPP_DOMAIN }}"

    c2s_require_encryption = false

{{ if $ENABLE_GUEST_DOMAIN }}
VirtualHost "{{ .Env.XMPP_GUEST_DOMAIN }}"
    authentication = "anonymous"
    c2s_require_encryption = false

    {{ if $ENABLE_LOBBY }}
    modules_enabled = {
        "muc_lobby_rooms";
    }

    main_muc = "{{ .Env.XMPP_MUC_DOMAIN }}"
    lobby_muc = "lobby.{{ .Env.XMPP_DOMAIN }}"
    {{ if .Env.XMPP_RECORDER_DOMAIN }}
    muc_lobby_whitelist = { "{{ .Env.XMPP_RECORDER_DOMAIN }}" }
    {{ end }}
    {{ end }}

{{ end }}

VirtualHost "{{ .Env.XMPP_AUTH_DOMAIN }}"
    ssl = {
        key = "/config/certs/{{ .Env.XMPP_AUTH_DOMAIN }}.key";
        certificate = "/config/certs/{{ .Env.XMPP_AUTH_DOMAIN }}.crt";
    }
    authentication = "internal_hashed"

{{ if .Env.XMPP_RECORDER_DOMAIN }}
VirtualHost "{{ .Env.XMPP_RECORDER_DOMAIN }}"
    modules_enabled = {
      "ping";
    }
    authentication = "internal_hashed"
{{ end }}

Component "{{ .Env.XMPP_INTERNAL_MUC_DOMAIN }}" "muc"
    storage = "memory"
    modules_enabled = {
        "ping";
        {{ if .Env.XMPP_INTERNAL_MUC_MODULES }}
        "{{ join "\";\n\"" (splitList "," .Env.XMPP_INTERNAL_MUC_MODULES) }}";
        {{ end }}
        {{ if .Env.ENABLE_RECORDING }}
        "allow_jibri_tobypass";
        {{ end }}
    }
    muc_room_locking = false
    muc_room_default_public_jids = true

Component "{{ .Env.XMPP_MUC_DOMAIN }}" "muc"
    storage = "memory"
    modules_enabled = {
        "muc_meeting_id";
        {{ if .Env.XMPP_MUC_MODULES }}
        "{{ join "\";\n\"" (splitList "," .Env.XMPP_MUC_MODULES) }}";
        {{ end }}
        {{ if and $ENABLE_AUTH (eq $AUTH_TYPE "jwt") }}
        "{{ $JWT_TOKEN_AUTH_MODULE }}";
        "token_affiliation";
        {{ end }}
        {{ if .Env.ENABLE_RECORDING }}
        "allow_jibri_tobypass";
        {{ end }}
        -- {{ if eq $ENABLE_SUBDOMAINS "true" }}    
        -- "muc_domain_mapper";
        -- {{ end }}
        -- {{ if eq $AUTH_TYPE "jwt" }}    
        -- "muc_allowners";    
        -- {{ end }}
        
    }
    muc_room_cache_size = 1000
    muc_room_locking = false
    muc_room_default_public_jids = true
    -- {{ if eq $AUTH_TYPE "jwt" }}
    -- allowners_moderated_subdomains = {
    --     "subdomain";
    -- }
    -- allowners_moderated_rooms = {
    --     "myroom";
    -- }
    -- {{ end }}

Component "conference.{{ .Env.XMPP_DOMAIN }}" "muc"
storage = "memory"
modules_enabled = {
    "muc_meeting_id";
    {{ if eq $ENABLE_SUBDOMAINS "true" }}    
        "muc_domain_mapper";
    {{ end }}
}

Component "focus.{{ .Env.XMPP_DOMAIN }}"
    component_secret = "{{ .Env.JICOFO_COMPONENT_SECRET }}"

Component "speakerstats.{{ .Env.XMPP_DOMAIN }}" "speakerstats_component"
    muc_component = "{{ .Env.XMPP_MUC_DOMAIN }}"

Component "conferenceduration.{{ .Env.XMPP_DOMAIN }}" "conference_duration_component"
    muc_component = "{{ .Env.XMPP_MUC_DOMAIN }}"

{{ if $ENABLE_LOBBY }}
Component "lobby.{{ .Env.XMPP_DOMAIN }}" "muc"
    storage = "memory"
    restrict_room_creation = true
    muc_room_locking = false
    muc_room_default_public_jids = true
{{ end }}

XMPP_MUC_DOMAIN env variable should start with “conference”. My environment variables;

AUTH_TYPE: jwt
DISABLE_HTTPS: “1”
ENABLE_AUTH: “1”
ENABLE_GUESTS: “1”
GLOBAL_CONFIG: |-
muc_mapper_domain_base = “example.com”;
cross_domain_bosh = true;
enable_domain_verification = true;
GLOBAL_MODULES: carbons,blocklist,muc_domain_mapper
JIBRI_BREWERY_MUC: jibribrewery
JIBRI_PENDING_TIMEOUT: “90”
JIBRI_RECORDER_USER: recorder
JIBRI_XMPP_USER: jibri
JICOFO_AUTH_USER: focus
JVB_AUTH_USER: jvb
JVB_BREWERY_MUC: jvbbrewery
JVB_ENABLE_APIS: rest,colibri
JVB_PORT: “31750”
JVB_STUN_SERVERS: stun.l.google.com:19302, stun1.l.google.com:19302, stun2.l.google.com:19302
JVB_TCP_HARVESTER_DISABLED: “true”
JWT_ALLOW_EMPTY: “1”
TZ: Europe/Istanbul
XMPP_AUTH_DOMAIN: auth.example.com
XMPP_BOSH_URL_BASE: http://xmpp:5280
XMPP_DOMAIN: t.ahtapot.chat
XMPP_GUEST_DOMAIN: guest-example.com
XMPP_INTERNAL_MUC_DOMAIN: internal-conference.example.com
XMPP_MUC_DOMAIN: conference.example.com
XMPP_MUC_MODULES: muc_meeting_id,muc_domain_mapper
XMPP_RECORDER_DOMAIN: recorder.example.com
XMPP_SERVER: xmpp

Thanks @Suleyman_Sahin for sharing it. The other way to use muc_domain_mapper without changing the XMPP_MUC_DOMAIN to conference is to set the value of muc_mapper_domain_prefix = "muc" in jitsi-meet.cfg.lua file. This is what I did.