404 Error from HTTP request made to Prosody Plugin

Hi,
I am trying to write an API to get some information on jitsi rooms and participants. First I was trying to run and test the prosody-plugin mod_muc_size.lua. I am not able to call the APIs defined in mod_muc_size.lua as the output for the following curl command gives a 404 error.

Command:

curl http://127.0.0.1:5280/session
or
curl http://127.0.0.1:5280/room?room=test&domain=dev.meet.domain.com

Output:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>404 Not Found</title>
<style>
body{
margin-top:14%;
text-align:center;
background-color:#F8F8F8;
font-family:sans-serif;
}
h1{
font-size:xx-large;
}
p{
font-size:x-large;
}
p+p {
font-size:large;
font-family:courier;
}
</style>
</head>
<body>
<h1>404 Not Found</h1>
<p>Whatever you were looking for is not here. It&apos;s behind you.</p>
<p>Unknown host: 127.0.0.1</p>
</body>
</html>

Following is my configuration file.

VirtualHost "dev.meet.domain.com"
    -- enabled = false -- Remove this line to enable this host
    authentication = "anonymous"
    -- Properties below are modified by jitsi-meet-tokens package config
    -- and authentication above is switched to "token"
    --app_id="example_app_id"
    --app_secret="example_app_secret"
    -- Assign this host a certificate for TLS, otherwise it would use the one
    -- set in the global section (if any).
    -- Note that old-style SSL on port 5223 only supports one certificate, and will always
    -- use the global one.
    ssl = {
        key = "/etc/prosody/certs/dev.meet.domain.com.key";
        certificate = "/etc/prosody/certs/dev.meet.domain.com.crt";
    }
    av_moderation_component = "avmoderation.dev.meet.domain.com"
    speakerstats_component = "speakerstats.dev.meet.domain.com"
    conference_duration_component = "conferenceduration.dev.meet.domain.com"
    -- we need bosh
    modules_enabled = {
        "bosh";
	"http";
        "pubsub";
        "ping"; -- Enable mod_ping
        "speakerstats";
        "external_services";
        "conference_duration";
        "muc_lobby_rooms";
        "muc_breakout_rooms";
        "av_moderation";
	"muc_size";
    }
    c2s_require_encryption = false
    lobby_muc = "lobby.dev.meet.domain.com"
    breakout_rooms_muc = "breakout.dev.meet.domain.com"
    main_muc = "conference.dev.meet.domain.com"
    -- muc_lobby_whitelist = { "recorder.dev.meet.domain.com" } -- Here we can whitelist jibri to enter lobby enabled rooms

Component "conference.dev.meet.domain.com" "muc"
    restrict_room_creation = true
    storage = "memory"
    modules_enabled = {
        "muc_meeting_id";
        "muc_domain_mapper";
        "polls";
        --"token_verification";
        "muc_rate_limit";
	"muc_size";
	"http";
    }
    admins = { "focus@auth.dev.meet.domain.com" }
    muc_room_locking = false
    muc_room_default_public_jids = true

I have the mod_muc_size.lua file at /usr/share/jitsi-meet/prosody-plugins and can confirm that the plugin is loaded. (Confirmed by putting a log inside.) Also I get no errors in any of the prosody.log, prosody.err, nginx.log files.

I guess that the 5280 port works well because I have checked curl http://127.0.0.1:5280/http-bind command and it works well.

<html><body>
	<p>It works! Now point your BOSH client to this URL to connect to Prosody.</p>
	<p>For more information see <a href="https://prosody.im/doc/setting_up_bosh">Prosody: Setting up BOSH</a>.</p>
	</body>

My lua version - 5.2

How can I resolve this and in which level can these requests made to mod_muc_size.lua fail?
Thanks in advance.

You are requesting it on domain 127.0.0.1, where the module is running on dev.meet.domain.com.

Hi @damencho , Thanks for replying, I am running the curl command from the server. Not from my local machine. Means I am logged into the server running jitsi. Should the command still be different?

Doesn’t matter, I’m telling you why it doesn’t work on prosody point of view. You may add nginx proxy rule to pass correct http host header with correct domain.

Thanks for the comments @damencho . They helped me to resolve the problem. I added a rule to my nginx config on the server like this.

location = /room {
        proxy_pass http://127.0.0.1:5280/room?$args&domain=dev.meet.domain.com;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host dev.meet.domain.com;
        add_header Content-Type "application/json; charset=UTF-8";
        add_header 'Access-Control-Allow-Origin' '*';
    }

https://dev.meet.domain.com/room?room=1234

I am now able to access the API from my local environment. The request is correctly being routed to the prosody service at the server level.

Make sure you protected somehow so it is not public so anyone can check rooms :slight_smile:

1 Like