meet.conf 6.1 KB

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