meet.conf 6.8 KB

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