jicofo icon indicating copy to clipboard operation
jicofo copied to clipboard

Cross domain problem

Open stiekel opened this issue 6 years ago • 11 comments

I need to use jitsi in my webapp, and the webapp was served on different server, if I call jitsi from the webapp, the http-bind return cross domain problem.

jicofo cross domain problem jicofo cross domain netowrk tab

in real world, the Jicofo and client may served on multiple servers, Can we set the jicofo to support CORS as default? or anyone can tell me how to set the jicofo support cross domain?

stiekel avatar Sep 18 '17 08:09 stiekel

This is not jicofo, this is jitsi-videobridge that is serving jitsi-meet web app using jetty.

There is no option currently to change cross-origin. In order to add it you need to modify where the bosh servlet is initialized: https://github.com/jitsi/jitsi-videobridge/blob/c6acc4aea85c7984ab713ad19d54bc0fc8ac0aa4/src/main/java/org/jitsi/videobridge/rest/PublicRESTBundleActivator.java#L220 Something like the solution described here: https://stackoverflow.com/questions/29969996/set-access-control-allow-origin-in-jetty And of course, it needs adding the maven artifact containing CrossOriginFilter: <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-servlets</artifactId>

damencho avatar Sep 19 '17 15:09 damencho

This is a jitsi-videobridge issue. But what are you trying to achieve, having jvb and jicofo on different machines? Having multiple bridges? I suppose, there are different solutions for your problem that can be implemented without changing the code for any of the components.

damencho avatar Sep 19 '17 15:09 damencho

Thanks so much, We want to add video conference in webapp with jitsi, in my first demo, the jvb and jicofo are in same server, but the webapp served on other machine, so i need jitsi support CORS.

I will check the jvb document, thank you @damencho .

stiekel avatar Sep 20 '17 02:09 stiekel

Thanks so much, We want to add video conference in webapp with jitsi, in my first demo, the jvb and jicofo are in same server, but the webapp served on other machine, so i need jitsi support CORS.

I don't think there's any need for CORS in any of the jitsi components. The web-app only communicates (via http) with prosody, and we use a proxy for "/http-bind" instead.

bgrozev avatar Sep 20 '17 02:09 bgrozev

@bgrozev when i request /http-bind directly, Jetty response with Access Control Allow Origin error.

stiekel avatar Sep 20 '17 03:09 stiekel

@bgrozev And after i config nginx with this guide, Nginx response with BOSH-Connection failed: host-unknown . BOSH-Connection failed: host-unknown

stiekel avatar Sep 20 '17 03:09 stiekel

Look at the request in the "network" tab.

bgrozev avatar Sep 20 '17 08:09 bgrozev

@bgrozev

http-bind is proxied, but Jetty strips all of the headers from Prosody, so even configuring Prosody itself to produce the relevant CORS headers doesn't help.

In the past via the NGINX strategy it was possible to allow a remote origin to connect via BOSH to the videobridge endpoints.

@damencho,

I've tried building a new jitsi-videobridge with a CrossOriginFilter adding those headers in, but the bridge just hangs the moment that filter is added to the servletContextHandler.

Does anyone have a reasonable workaround here?

I think perhaps at the moment it seems like disabling the HTTP service and jetty, and just serving the videobridge itself via port 443 is the most reasonable solution, but it would be great to work through jetty itself.

thedracle avatar Jun 08 '18 23:06 thedracle

I've tried building a new jitsi-videobridge with a CrossOriginFilter adding those headers in, but the bridge just hangs the moment that filter is added to the servletContextHandler.

Did you use this patch? https://github.com/jitsi/jitsi-videobridge/pull/675

bgrozev avatar Jun 09 '18 00:06 bgrozev

@bgrozev, That worked great, thankyou!

thedracle avatar Jun 11 '18 18:06 thedracle

@raghbendranayak please do not hijack issues and post the same question over and over again. You are not increasing your chances of an answer, but the other way around.

damencho avatar Nov 17 '18 14:11 damencho

Probably outdated, re-open if necessary

bgrozev avatar Jan 04 '23 20:01 bgrozev