meet.conf 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. {{ $ENABLE_COLIBRI_WEBSOCKET := .Env.ENABLE_COLIBRI_WEBSOCKET | default "1" | toBool }}
  2. {{ $COLIBRI_WEBSOCKET_PORT := .Env.COLIBRI_WEBSOCKET_PORT | default "9090" }}
  3. {{ $COLIBRI_WEBSOCKET_REGEX := .Env.COLIBRI_WEBSOCKET_REGEX | default "jvb" }}
  4. {{ $ENABLE_JAAS_COMPONENTS := .Env.ENABLE_JAAS_COMPONENTS | default "0" | toBool }}
  5. {{ $ENABLE_OCTO := .Env.ENABLE_OCTO | default "0" | toBool -}}
  6. {{ $ENABLE_XMPP_WEBSOCKET := .Env.ENABLE_XMPP_WEBSOCKET | default "1" | toBool }}
  7. {{ $ENABLE_SUBDOMAINS := .Env.ENABLE_SUBDOMAINS | default "true" | toBool -}}
  8. {{ $XMPP_DOMAIN := .Env.XMPP_DOMAIN | default "meet.jitsi" -}}
  9. {{ $XMPP_BOSH_URL_BASE := .Env.XMPP_BOSH_URL_BASE | default "http://xmpp.meet.jitsi:5280" -}}
  10. server_name _;
  11. charset utf8;
  12. client_max_body_size 0;
  13. root /usr/share/jitsi-meet;
  14. # ssi on with javascript for multidomain variables in config.js
  15. ssi on;
  16. ssi_types application/x-javascript application/javascript;
  17. index index.html index.htm;
  18. error_page 404 /static/404.html;
  19. # Security headers
  20. add_header X-Content-Type-Options nosniff;
  21. add_header X-XSS-Protection "1; mode=block";
  22. set $prefix "";
  23. {{ if .Env.DEPLOYMENTINFO_SHARD }}
  24. add_header X-Jitsi-Shard {{ .Env.DEPLOYMENTINFO_SHARD }};
  25. {{ end }}
  26. # Opt out of FLoC (deprecated)
  27. add_header Permissions-Policy "interest-cohort=()";
  28. location = /config.js {
  29. alias /config/config.js;
  30. }
  31. location = /interface_config.js {
  32. alias /config/interface_config.js;
  33. }
  34. location = /external_api.js {
  35. alias /usr/share/jitsi-meet/libs/external_api.min.js;
  36. }
  37. {{ if $ENABLE_JAAS_COMPONENTS }}
  38. location = /_api/room-info {
  39. proxy_pass {{ $XMPP_BOSH_URL_BASE }}/room-info?prefix=$prefix&$args;
  40. proxy_http_version 1.1;
  41. proxy_set_header X-Forwarded-For $remote_addr;
  42. proxy_set_header Host $http_host;
  43. }
  44. {{ end }}
  45. # ensure all static content can always be found first
  46. location ~ ^/(libs|css|static|images|fonts|lang|sounds|connection_optimization|.well-known)/(.*)$ {
  47. add_header 'Access-Control-Allow-Origin' '*';
  48. alias /usr/share/jitsi-meet/$1/$2;
  49. # cache all versioned files
  50. if ($arg_v) {
  51. expires 1y;
  52. }
  53. }
  54. {{ if $ENABLE_COLIBRI_WEBSOCKET }}
  55. # colibri (JVB) websockets
  56. location ~ ^/colibri-ws/({{ $COLIBRI_WEBSOCKET_REGEX }})/(.*) {
  57. tcp_nodelay on;
  58. proxy_http_version 1.1;
  59. proxy_set_header Upgrade $http_upgrade;
  60. proxy_set_header Connection $connection_upgrade;
  61. proxy_pass http://$1:{{ $COLIBRI_WEBSOCKET_PORT }}/colibri-ws/$1/$2$is_args$args;
  62. }
  63. {{ if $ENABLE_OCTO }}
  64. # colibri (JVB) Relay to Relay websockets
  65. location ~ ^/colibri-relay-ws/([a-zA-Z0-9-\._]+)/(.*) {
  66. tcp_nodelay on;
  67. proxy_http_version 1.1;
  68. proxy_set_header Upgrade $http_upgrade;
  69. proxy_set_header Connection $connection_upgrade;
  70. proxy_pass http://$1:{{ $COLIBRI_WEBSOCKET_PORT }}/colibri-relay-ws/$1/$2$is_args$args;
  71. }
  72. {{ end }}
  73. {{ end }}
  74. # BOSH
  75. location = /http-bind {
  76. proxy_set_header X-Forwarded-For $remote_addr;
  77. proxy_set_header Host {{ $XMPP_DOMAIN }};
  78. proxy_pass {{ $XMPP_BOSH_URL_BASE }}/http-bind?prefix=$prefix&$args;
  79. }
  80. {{ if $ENABLE_XMPP_WEBSOCKET }}
  81. # xmpp websockets
  82. location = /xmpp-websocket {
  83. tcp_nodelay on;
  84. proxy_http_version 1.1;
  85. proxy_set_header Connection $connection_upgrade;
  86. proxy_set_header Upgrade $http_upgrade;
  87. proxy_set_header Host {{ $XMPP_DOMAIN }};
  88. proxy_set_header X-Forwarded-For $remote_addr;
  89. proxy_pass {{ $XMPP_BOSH_URL_BASE }}/xmpp-websocket?prefix=$prefix&$args;
  90. }
  91. {{ end }}
  92. {{ if .Env.ETHERPAD_URL_BASE }}
  93. # Etherpad-lite
  94. location ^~ /etherpad/ {
  95. proxy_buffering off;
  96. proxy_cache_bypass $http_upgrade;
  97. proxy_http_version 1.1;
  98. proxy_set_header Upgrade $http_upgrade;
  99. proxy_set_header Connection "upgrade";
  100. proxy_set_header X-Forwarded-For $remote_addr;
  101. proxy_pass {{ .Env.ETHERPAD_URL_BASE }}/;
  102. }
  103. {{ end }}
  104. location ~ ^/([^/?&:'"]+)$ {
  105. try_files $uri @root_path;
  106. }
  107. location @root_path {
  108. rewrite ^/(.*)$ / break;
  109. }
  110. {{ if $ENABLE_SUBDOMAINS }}
  111. # Matches /(TENANT)/pwa-worker.js or /(TENANT)/manifest.json to rewrite to / and look for file
  112. location ~ ^/([^/?&:'"]+)/(pwa-worker.js|manifest.json)$ {
  113. set $subdomain "$1.";
  114. set $subdir "$1/";
  115. rewrite ^/([^/?&:'"]+)/(pwa-worker.js|manifest.json)$ /$2;
  116. }
  117. location ~ ^/([^/?&:'"]+)/config.js$ {
  118. set $subdomain "$1.";
  119. set $subdir "$1/";
  120. alias /config/config.js;
  121. }
  122. # BOSH for subdomains
  123. location ~ ^/([^/?&:'"]+)/http-bind {
  124. set $subdomain "$1.";
  125. set $subdir "$1/";
  126. set $prefix "$1";
  127. rewrite ^/(.*)$ /http-bind;
  128. }
  129. {{ if $ENABLE_XMPP_WEBSOCKET }}
  130. # websockets for subdomains
  131. location ~ ^/([^/?&:'"]+)/xmpp-websocket {
  132. set $subdomain "$1.";
  133. set $subdir "$1/";
  134. set $prefix "$1";
  135. rewrite ^/(.*)$ /xmpp-websocket;
  136. }
  137. {{ end }}
  138. {{ if $ENABLE_JAAS_COMPONENTS }}
  139. location ~ ^/([^/?&:'"]+)/_api/room-info {
  140. set $subdomain "$1.";
  141. set $subdir "$1/";
  142. set $prefix "$1";
  143. rewrite ^/(.*)$ /_api/room-info;
  144. }
  145. {{ end }}
  146. # Anything that didn't match above, and isn't a real file, assume it's a room name and redirect to /
  147. location ~ ^/([^/?&:'"]+)/(.*)$ {
  148. set $subdomain "$1.";
  149. set $subdir "$1/";
  150. rewrite ^/([^/?&:'"]+)/(.*)$ /$2;
  151. }
  152. {{ end }}