meet.conf 6.8 KB

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