meet.conf 4.7 KB

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