Navigation

    Kopano
    • Register
    • Login
    • Search
    • Categories
    • Get Official Kopano Support
    • Recent
    Statement regarding the closure of the Kopano community forum and the end of the community edition

    [INVALID / CORS] Help with MM and Meet on different subdomains

    Kopano Mattermost
    2
    2
    552
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • irreleph4nt
      irreleph4nt last edited by irreleph4nt

      EDIT: On a new install I found that most of the below is caused by incorrect CORS headers on the meet config in nginx. The screen remains blank but the errors in console disappear.

      Hi,

      I am having 3 problems getting the MM webmeetings plugin to work and could really use some help here, please. I have to say though that mattermost for me runs on chat.domain.tld whilst everything meet-related lives under meet.domain.tld. I am using nginx - meet and mattermost by themselves work, just not together.

      Error messages from the browser console - symptom: with webmeetings enabled as a plugin, the screen stays blank when you try to access MM outside of the System Console:

      Loading kopanowebmeetings plugin index.js:89:12
      UserStatuses 
      Object { OFFLINE: "offline", AWAY: "away", ONLINE: "online", DND: "dnd" }
      kopanowebmeetings_12fef58e467ea96c_bundle.js:101:30949
      Loaded kopanowebmeetings plugin index.js:75:16
      failed to get KWM config - retrying 1 Error: "Request failed with status code 401"
          exports https://chat.maerz.cc/static/plugins/kopanowebmeetings/kopanowebmeetings_12fef58e467ea96c_bundle.js:19
          exports https://chat.maerz.cc/static/plugins/kopanowebmeetings/kopanowebmeetings_12fef58e467ea96c_bundle.js:91
          d https://chat.maerz.cc/static/plugins/kopanowebmeetings/kopanowebmeetings_12fef58e467ea96c_bundle.js:19
      kopanowebmeetings_12fef58e467ea96c_bundle.js:101:20384
      failed to get KWM config - retrying 2 Error: "Request failed with status code 401"
          exports https://chat.maerz.cc/static/plugins/kopanowebmeetings/kopanowebmeetings_12fef58e467ea96c_bundle.js:19
          exports https://chat.maerz.cc/static/plugins/kopanowebmeetings/kopanowebmeetings_12fef58e467ea96c_bundle.js:91
          d https://chat.maerz.cc/static/plugins/kopanowebmeetings/kopanowebmeetings_12fef58e467ea96c_bundle.js:19
      kopanowebmeetings_12fef58e467ea96c_bundle.js:101:20384
      failed to get KWM config - retrying 3 Error: "Request failed with status code 401"
          exports https://chat.maerz.cc/static/plugins/kopanowebmeetings/kopanowebmeetings_12fef58e467ea96c_bundle.js:19
          exports https://chat.maerz.cc/static/plugins/kopanowebmeetings/kopanowebmeetings_12fef58e467ea96c_bundle.js:91
          d https://chat.maerz.cc/static/plugins/kopanowebmeetings/kopanowebmeetings_12fef58e467ea96c_bundle.js:19
      kopanowebmeetings_12fef58e467ea96c_bundle.js:101:20384
      failed to get KWM config - retrying 4 Error: "Request failed with status code 401"
          exports https://chat.maerz.cc/static/plugins/kopanowebmeetings/kopanowebmeetings_12fef58e467ea96c_bundle.js:19
          exports https://chat.maerz.cc/static/plugins/kopanowebmeetings/kopanowebmeetings_12fef58e467ea96c_bundle.js:91
          d https://chat.maerz.cc/static/plugins/kopanowebmeetings/kopanowebmeetings_12fef58e467ea96c_bundle.js:19
      kopanowebmeetings_12fef58e467ea96c_bundle.js:101:20384
      failed to get KWM config - retrying 5 Error: "Request failed with status code 401"
          exports https://chat.maerz.cc/static/plugins/kopanowebmeetings/kopanowebmeetings_12fef58e467ea96c_bundle.js:19
          exports https://chat.maerz.cc/static/plugins/kopanowebmeetings/kopanowebmeetings_12fef58e467ea96c_bundle.js:91
          d https://chat.maerz.cc/static/plugins/kopanowebmeetings/kopanowebmeetings_12fef58e467ea96c_bundle.js:19
      kopanowebmeetings_12fef58e467ea96c_bundle.js:101:20384
      failed to get KWM config - retrying 6 Error: "Request failed with status code 401"
          exports https://chat.maerz.cc/static/plugins/kopanowebmeetings/kopanowebmeetings_12fef58e467ea96c_bundle.js:19
          exports https://chat.maerz.cc/static/plugins/kopanowebmeetings/kopanowebmeetings_12fef58e467ea96c_bundle.js:91
          d https://chat.maerz.cc/static/plugins/kopanowebmeetings/kopanowebmeetings_12fef58e467ea96c_bundle.js:19
      kopanowebmeetings_12fef58e467ea96c_bundle.js:101:20384
      websocket connecting to wss://chat.maerz.cc/api/v4/websocket websocket_client.jsx:35:20
      RootContainer.render kopanowebmeetings_12fef58e467ea96c_bundle.js:101:33256
      websocket closed websocket_client.jsx:156:20
      TypeError: "r is null"
          value kopanowebmeetings_12fef58e467ea96c_bundle.js:101
          React 11
          t needs_team.jsx:185
          i es6.promise.js:75
          S es6.promise.js:92
          u _microtask.js:18
      react-dom.production.min.js:198:186
      Unhandled promise rejection TypeError: "r is null"
          value kopanowebmeetings_12fef58e467ea96c_bundle.js:101
          React 11
          t needs_team.jsx:185
          i es6.promise.js:75
          S es6.promise.js:92
          u _microtask.js:18
      es6.promise.js:110
      config fetched 
      Object { kwmserver_url: "https://meet.maerz.cc", stun_uri: "meet.maert.cc:5349", turn_uri: "meet.maerz.cc:5349?transport=tcp", turn_username: "1559311286:mattermost-kwm-user", turn_password: "XymLN8lKIfQOmWByymDK1YneJfE=", expires_in: 3600, token: {…} }
      kopanowebmeetings_12fef58e467ea96c_bundle.js:101:21358
      KWM connect dw4m6ui6cfrm5nm8kkporrn84r kopanowebmeetings_12fef58e467ea96c_bundle.js:85:3033
      Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://meet.maerz.cc/api/v1/rtm.connect. (Reason: CORS request external redirect not allowed).
      
      Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://meet.maerz.cc/api/v1/rtm.connect. (Reason: CORS preflight channel did not succeed).
      
      failed to fetch connection details TypeError: "NetworkError when attempting to fetch resource." kopanowebmeetings_12fef58e467ea96c_bundle.js:85:5659
      Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://meet.maerz.cc/api/v1/rtm.connect. (Reason: CORS request did not succeed).
      
      KWM connect dw4m6ui6cfrm5nm8kkporrn84r
      

      There appear to be 3 problems:

      1. When the login screen for MM comes up, I receive 401 unauthorised errors related to the bundle.js of the plugin. Clicking on the link in the error brings up the file just fine, though.
      2. There is an “Type r is null” error shown for the plugin itself. I have uploaded the tar.gz file for version 0.3.0 from the community download server here
      3. I am getting errors related to CORS which I have tried to solve with the nginx config below, but that apparently does not work. The CORS error just repeats over and over in the console.

      This is my nginx config for everything meet:

      upstream konnect {
      	server 127.0.0.1:8777;
      }
      
      upstream kapi {
      	server 127.0.0.1:8039;
      }
      
      upstream kwmserver {
      	server 127.0.0.1:8778;
      }
      
      server{
      	listen 80;
      	charset utf-8;
      	listen [::]:80;
      	server_name meet.maerz.cc;
      
      	location / {
      		rewrite   ^(.*)   https://$server_name$1 permanent;
      	}
      }
      
      server {
      
      	charset utf-8;
      	listen 443 ssl http2;
      	server_name meet.maerz.cc;
      	client_max_body_size 1024m;
      	ssl_certificate /etc/ssl/maerz.cc/maerz.cc.crt;
      	ssl_certificate_key /etc/ssl/maerz.cc/maerz.cc.key;
      	ssl_session_cache shared:SSL:1m;
      	ssl_session_timeout 5m;
      	ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      	ssl_ciphers ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA256;
      	ssl_prefer_server_ciphers on;
      	#
      	# ssl_dhparam require you to create a dhparam.pem, this takes a long time
      	ssl_dhparam /etc/ssl/dhparam.pem;
      
      	set $cors_origin "";
      	set $cors_header "";
      	set $cors_method "";
      
      	if ($http_origin ~ '^https?://(localhost|chat\.maerz\.cc)$') {
      		set $cors_origin $http_origin;
      		set $cors_header $http_access_control_request_headers;
      		set $cors_method $http_access_control_request_method;
      	}
      
      	add_header Access-Control-Allow-Origin      $cors_origin;
      	add_header Access-Control-Allow-Headers     $cors_header;
      	add_header Access-Control-Allow-Methods     $cors_method;
      
      
      	location / {
              	return 301 https://$server_name/meet;
      	}
      
      	location /favicon.ico {
              	alias /usr/share/webapps/favicon.ico;
      	}
      
      	location /.well-known/openid-configuration {
              	proxy_pass http://konnect/.well-known/openid-configuration;
      	}
      
      	location /konnect/v1/jwks.json {
              	proxy_pass http://konnect/konnect/v1/jwks.json;
      	}
      
      	location /konnect/v1/token {
              	proxy_pass http://konnect/konnect/v1/token ;
      	}
      
      	location /konnect/v1/userinfo {
              	proxy_pass http://konnect/konnect/v1/userinfo;
      	}
      
      	location /konnect/v1/static {
              	proxy_pass http://konnect/konnect/v1/static;
      	}
      
      	location /konnect/v1/session {
              	proxy_pass http://konnect/konnect/v1/session;
      	}
      
      	location /signin/ {
              	proxy_set_header Host $host;
              	proxy_set_header X-Forwarded-Proto $scheme;
              	proxy_set_header X-Forwarded-Port $server_port;
              	proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
              	proxy_pass http://konnect/signin/;
      	}
      
      	location /api/gc/ {
              	proxy_pass http://kapi/api/gc/;
      	}
      
      	# kapi pubs
      	location /api/pubs/ {
              	proxy_pass http://kapi/api/pubs;
              	proxy_http_version 1.1;
              	proxy_set_header Upgrade $http_upgrade;
              	proxy_set_header Connection "Upgrade";
      	}
      
      	# disable caching for the service-worker
      	location /meet/service-worker.js {
              	alias /usr/share/webapps/kopano-meet/service-worker.js;
              	expires -1;
      	}
      
      	location /meet {
              	rewrite ^/meet/r/(.*)$ /meet last;
              	alias /usr/share/webapps/kopano-meet/;
      	}
      
      	location /api/config/v1/kopano/meet/config.json {
              	# When using default values this setting can be kept as it is please adapt
              	# the next line ap copy config.json to /etc/kopano if user modifications
              	# are needed
              	alias /usr/share/webapps/kopano-meet/config.json;
      	}
      
      	location /api/v1/websocket/ {
              	proxy_pass http://kwmserver/api/v1/websocket/;
              	proxy_http_version 1.1;
              	proxy_set_header Upgrade $http_upgrade;
              	proxy_set_header Connection "Upgrade";
      		proxy_set_header Connection "";
      		proxy_set_header Host $http_host;
      		proxy_set_header X-Real-IP $remote_addr;
      		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      		proxy_set_header X-Forwarded-Proto $scheme;
      		proxy_set_header X-Frame-Options SAMEORIGIN;
      		proxy_buffers 256 16k;
      		proxy_buffer_size 16k;
      		proxy_read_timeout 600s;
      	}
      
      	location /api/v1/ {
              	proxy_pass http://kwmserver/api/v1/;
      	}
      
      	location /api/v1/rtm.connect/ {
              	proxy_pass http://kwmserver/api/v1/rtm.connect/;
              	proxy_http_version 1.1;
              	proxy_set_header Upgrade $http_upgrade;
              	proxy_set_header Connection "Upgrade";
      		proxy_set_header Host $http_host;
      		proxy_set_header X-Real-IP $remote_addr;
      		proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      		proxy_set_header X-Forwarded-Proto $scheme;
      		proxy_set_header X-Frame-Options SAMEORIGIN;
      		proxy_buffers 256 16k;
      		proxy_buffer_size 16k;
      		proxy_read_timeout 600s;
      	}
      
      	location /api/v1/rtm.turn/ {
              	proxy_pass http://kwmserver/api/v1/rtm.turn/;
              	proxy_http_version 1.1;
              	proxy_set_header Upgrade $http_upgrade;
              	proxy_set_header Connection "Upgrade";
      	}
      
      	location /api/kwm/v2/ {
              	proxy_pass http://kwmserver/api/kwm/v2/;
              	proxy_http_version 1.1;
              	proxy_set_header Upgrade $http_upgrade;
              	proxy_set_header Connection "Upgrade";
      	}
      
      	location /api/kvs/ {
              	proxy_pass http://kapi/api/kvs/;
              	proxy_http_version 1.1;
             		proxy_set_header Upgrade $http_upgrade;
              	proxy_set_header Connection "Upgrade";
      	}
      }
      
      

      Any help you can provide to resolve this is appreciated!

      Thanks for reading.

      fbartels 1 Reply Last reply Reply Quote 0
      • fbartels
        fbartels Kopano @irreleph4nt last edited by

        Hi @irreleph4nt,

        the webmeetings plugin and meet are two separate pieces of software, which at the moment do not interact (and only relate to each other because they are webrtc based and use kwmserver as a signalling server).

        That Mattermost sometimes does not load after enabling the plugin is known, but since there are not that many users using it we did have a priority for fixing this. Honestly there is even a chance that the plugin will be discontinued and be replaced with a simple wrapper around Meet.

        Regards Felix

        Resources:
        https://kopano.com/blog/how-to-get-kopano/
        https://documentation.kopano.io/
        https://kb.kopano.io/

        Support overview:
        https://kopano.com/support/

        1 Reply Last reply Reply Quote 0
        • First post
          Last post