janus behind nginx in WSL2

142 views
Skip to first unread message

Srinivas Bakki

unread,
Feb 15, 2023, 4:09:56 AM2/15/23
to meetecho-janus
Hi,
     I'm running janus in WSL2 windows 10. I have put it behind nginx whose config is :
server {
    listen 5000;
    root /home/sbakki/Janus/webserver/web/;
    index index.html;

    location ~* \.(js|jpg|png|css)$ {
            root /home/sbakki/Janus/webserver/web/;
    }

    location /janus {
            proxy_pass http://localhost:8088/janus/;
    }
}
On the windows machine i'm forwarding everything on port 5000 to WSL ip. I'm able to create session. But later attach fails.
Logs:
Using REST API to contact Janus: http://192.168.1.4:5000/janus
janus.js:1059 Created session: 2883249478150274
janus.js:118          GET http://192.168.1.4:5000/janus/2883249478150274?rid=1676451706073&maxev=10 net::ERR_ABORTED 404 (Not Found)
janus.js:692 API call failed: {message: 'API call failed', response: Response}

Janus is reachable but somehow it doesnt attache with the session ID. Can somebody tell what i'm doing wrong here.

Thanks,
Srinivas Bakki

Srinivas Bakki

unread,
Feb 15, 2023, 4:30:29 AM2/15/23
to meetecho-janus
I did proceed ahead, I had to include a '/' after janus as in :
server = "http://" + "192.168.1.4"  + ":5000/janus/"
in settings.js  Now, it goes ahead and fails with getUserMedia: 

Created session: 3985254261103733
janus.js:1390 Created handle: 2552851679134905
videoroomtest.js:59 Plugin attached! (janus.plugin.videoroom, id=2552851679134905)
videoroomtest.js:60   -- This is a publisher/manager
videoroomtest.js:135 Successfully joined room 1234 with ID 1649800870408013
janus.js:1870 Creating PeerConnection
janus.js:1877 Preparing local SDP and gathering candidates (trickle=true)
janus.js:2067 TypeError: Cannot read properties of undefined (reading 'getUserMedia')
    at captureDevices (janus.js:2397:45)
    at prepareWebrtc (janus.js:2035:11)
    at Object.createOffer (janus.js:1434:43)
    at publishOwnFeed (videoroomtest.js:453:10)
    at onmessage (videoroomtest.js:140:13)
    at handleEvent (janus.js:912:5)
    at Object.handleEvent [as success] (janus.js:713:5)
    at p.reject.message (janus.js:142:17)

Can somebody help with this ??

Thanks,
Srinivas Bakki

Lorenzo Miniero

unread,
Feb 15, 2023, 4:42:59 AM2/15/23
to meetecho-janus
getUserMedia only works on https, not http.

L.

Srinivas Bakki

unread,
Feb 15, 2023, 4:44:44 AM2/15/23
to meetecho-janus
:) just got to know, fixing that .. Thank you!

Srinivas Bakki

unread,
Feb 15, 2023, 11:29:36 AM2/15/23
to meetecho-janus
Hi,
     I've installed libmicrohttpd-dev package that comes with ubuntu. However that fails to start https server :

Binding to all interfaces for the Janus API HTTP webserver
HTTP webserver started (port 8088, /janus path listener)...
Using certificates:
        /opt/janus/certs/janus-selfsigned.crt
        /opt/janus/private/janus-selfsigned.key
Binding to all interfaces for the Janus API HTTPS webserver
[FATAL] [transports/janus_http.c:janus_http_init:843] Couldn't start secure webserver on port 8089...
Admin/monitor HTTP webserver disabled
Admin/monitor HTTPS webserver disabled
JANUS REST (HTTP/HTTPS) transport plugin initialized!

Do i have to build it by hand enabling HTTPS or is it enabled already ? The version install is : libmicrohttpd-dev:amd64 (0.9.75-3ubuntu1)

Thanks for any help.
Srinivas Bakki

Lorenzo Miniero

unread,
Feb 15, 2023, 12:31:28 PM2/15/23
to meetecho-janus
Don't enable https in Janus, let nginx deal with that since you're using it already.

L.

Srinivas Bakki

unread,
Feb 15, 2023, 1:21:47 PM2/15/23
to meetecho-janus
Excellent ! That works. Thank you!
Reply all
Reply to author
Forward
0 new messages