luvolondon / fvtt-module-jitsiwebrtc

Jitsi WebRTC client for FVTT
32 stars 8 forks source link

Access blocked by CORS policy (Custom Jitsi server) #62

Closed javieros105 closed 3 years ago

javieros105 commented 3 years ago

Hello. I've been having trouble with setting up my own jitsi server for foundry. I followed both the official Jitsi documentation and the guide by solfolango, trobuleshooted as much as possible but I don't know how to continue. Just so you know Jitsi is configured with internal_hashed authentication for creating meetings.

The console shows the following

jitsiIssue

Which is extremely weird because in between those CORS errors I do have some succesful binds

jitsiIssue2

From what I gather the module is able to create a room, if I use the bosh bind url it says it's succesful, but then it doesn't find it (?) when adding a user. So I'm very much lost

bekriebel commented 3 years ago

Make sure you have cross site access control (Access-Control-Allow-*) enabled for the BOSH /http-bind endpoint in your nginx configuration:

# BOSH
    location = /http-bind {
        proxy_pass      http://localhost:5280/http-bind;
        proxy_set_header X-Forwarded-For $remote_addr;
        proxy_set_header Host $http_host;
        add_header 'Access-Control-Allow-Origin' '*';
        add_header 'Access-Control-Allow-Credentials' 'true';
        add_header 'Access-Control-Allow-Methods' 'GET,HEAD,OPTIONS,POST,PUT';
        add_header 'Access-Control-Allow-Headers' 'Access-Control-Allow-Headers, Origin,Accept, X-Requested-With, Content-Type, Access-Control-Request-Method, Access-Control-Request-Headers';
    }
javieros105 commented 3 years ago

I actually already did that and still no luck. image

But after putting the option for cross_domain_bosh in the cfg.lua to false it doesn't throw any cors error, but still not good. image It gives me that error and gets stuck at asyc call to connect started

javieros105 commented 3 years ago

So I reinstalled jitsi and using it without credentials it manages to get the conference going apparently, but I get (in all players) that they can see their own webcam, but nothing on the others. Jitsi manages to make the user join and set the video element but then it never adds the track to the element (using the public jitsi server it manages to connect perfectly well).

image

bekriebel commented 3 years ago

What guide did you follow to set up your Jitsi server? It seems like there is something still misconfigured either on that server or on the server connection settings.

One additional thing to check is to make sure you do not have incorrect values set under the module settings. Unless there are unique values that aren't being set properly by your jitsi server's config, this option should be disabled: image.

If you are able to provide me with temporary credentials to your foundry instance and your jitsi server, I can try to take a look. To clarify, I don't want SSH credentials, but an FVTT gamemaster login and Jitsi credentials (unless you still have that set up with no authentication). I'm on the discord server as bekit#4213.

javieros105 commented 3 years ago

So I actually managed to make it work without password. I forgot to do one thing to actually make me realize the mistake and that's trying the server in 2 different machines. Since I'm mounting it on a raspberry pi, I needed to recompile for arm, followed this guide https://gist.github.com/krithin/e50a6001c8435e46cb85f5c6c78e2d66 and that allowed me to make it work. Now when I continued with the original guide by solfolango it kinda broke it up for foundry so I'm gonna follow the official guide for authentication and see if it works after all that.

Thanks for all the help, I'm going to try that and report back. Maybe when I get a bit of time I'll compile a guide for mounting everything up on a RPI4

EDIT: Finally made it work, I had to change in the .lua file that conference had the option storage="memory" same as with the internal auth I think it was. Now it's working perfectly. Thanks so much for the help and also the awesome module!