diff --git a/web/rootfs/defaults/meet.conf b/web/rootfs/defaults/meet.conf index f5d2c74..29587cf 100644 --- a/web/rootfs/defaults/meet.conf +++ b/web/rootfs/defaults/meet.conf @@ -1,44 +1,66 @@ +{{ $XMPP_BOSH_URL_BASE := .Env.XMPP_BOSH_URL_BASE | default "http://xmpp.meet.jitsi:5280" -}} +{{ $ENABLE_SUBDOMAINS := .Env.ENABLE_SUBDOMAINS | default "false" | toBool -}} + server_name _; client_max_body_size 0; root /usr/share/jitsi-meet; -index index.html +index index.html; error_page 404 /static/404.html; -location ~ ^/([a-zA-Z0-9=\?]+)$ { - rewrite ^/(.*)$ / break; -} +access_log /dev/stdout; +error_log /dev/stderr; + + +set $prefix ""; ssi on; ssi_types application/x-javascript application/javascript; -location /config.js { +location = /config.js { alias /config/config.js; } - -location /interface_config.js { +location = /interface_config.js { alias /config/interface_config.js; } -location /external_api.js { +location = /external_api.js { alias /usr/share/jitsi-meet/libs/external_api.min.js; } -location / { - ssi on; +{{ if .Env.ENABLE_BOSH_PROXY }} +location = /http-bind { + proxy_pass {{ $XMPP_BOSH_URL_BASE }}/http-bind; + proxy_set_header X-Forwarded-For $remote_addr; + proxy_set_header Host {{ .Env.XMPP_DOMAIN }}; } - -# BOSH -location /http-bind { - proxy_pass {{ .Env.XMPP_BOSH_URL_BASE }}/http-bind; +{{ if .Env.ENABLE_WEBSOCKETS }} +location = /xmpp-websocket { + proxy_pass {{ $XMPP_BOSH_URL_BASE }}/xmpp-websocket; + proxy_http_version 1.1; + proxy_set_header Upgrade $http_upgrade; + proxy_set_header Connection "upgrade"; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header Host {{ .Env.XMPP_DOMAIN }}; } +{{ end }} +{{ else }} +{{ if .Env.ENABLE_BOSH_REDIRECT }} +location = /http-bind { + return 404; +} +{{ if .Env.ENABLE_WEBSOCKETS }} +location = /xmpp-websocket { + return 404; +} +{{ end }} +{{ end }} +{{ end }} {{ if .Env.ETHERPAD_URL_BASE }} # Etherpad-lite -location /etherpad/ { +location = /etherpad/ { proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection 'upgrade'; @@ -51,3 +73,76 @@ location /etherpad/ { proxy_set_header Host {{ .Env.XMPP_DOMAIN }}; } {{ end }} + +location ~ ^/([^/?&:'"]+)$ { + try_files $uri @root_path; +} + +location @root_path { + rewrite ^/(.*)$ / break; +} + +location = / { + ssi on; +} + +{{ if $ENABLE_SUBDOMAINS }} +location ~ ^/([^/?&:'"]+)/config.js$ +{ + set $subdomain "$1."; + set $subdir "$1/"; + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Expose-Headers' "Content-Type, X-Jitsi-Region, X-Jitsi-Shard, X-Proxy-Region"; + + alias /config/config.js; +} + +location ~ ^/([^/?&:'"]+)/interface_config.js$ +{ + set $subdomain "$1."; + set $subdir "$1/"; + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Expose-Headers' "Content-Type, X-Jitsi-Region, X-Jitsi-Shard, X-Proxy-Region"; + + alias /config/interface_config.js; +} + +location ~ ^/([^/?&:'"]+)/libs/lib-jitsi-meet.min.js +{ + set $subdomain "$1."; + set $subdir "$1/"; + add_header 'Access-Control-Allow-Origin' '*'; + add_header 'Access-Control-Expose-Headers' "Content-Type, X-Jitsi-Region, X-Jitsi-Shard, X-Proxy-Region"; + alias /usr/share/jitsi-meet/libs/lib-jitsi-meet.min.js; +} + +location ~ ^/([^/?&:'"]+)/external_api.js { + alias /usr/share/jitsi-meet/libs/external_api.min.js; +} + +# Anything that didn't match above, and isn't a real file, assume it's a room name and redirect to / +# location ~ ^/([^/?&:'"]+)/(.*)$ { +# set $subdomain "$1."; +# set $subdir "$1/"; +# rewrite ^/([^/?&:'"]+)/(.*)$ /$2; +# } + +# # BOSH for subdomains +# location ~ ^/([^/?&:'"]+)/http-bind { +# set $subdomain "$1."; +# set $subdir "$1/"; +# set $prefix "$1"; + +# rewrite ^/(.*)$ /http-bind; +# } + +# # websockets for subdomains +# location ~ ^/([^/?&:'"]+)/xmpp-websocket { +# set $subdomain "$1."; +# set $subdir "$1/"; +# set $prefix "$1"; + +# rewrite ^/(.*)$ /xmpp-websocket; +# } + +{{ end }} \ No newline at end of file diff --git a/web/rootfs/etc/cont-init.d/10-config b/web/rootfs/etc/cont-init.d/10-config index 3f40d37..5432bad 100644 --- a/web/rootfs/etc/cont-init.d/10-config +++ b/web/rootfs/etc/cont-init.d/10-config @@ -73,18 +73,6 @@ if [[ ! -f /config/config.js ]]; then [ -z "$XMPP_RECORDER_DOMAIN" ] && export XMPP_RECORDER_DOMAIN="recorder.$XMPP_DOMAIN" tpl /defaults/config.js > /config/config.js - - if [[ ! -z "${ETHERPAD_URL_BASE}" && -z "$(grep -om1 'etherpad_base:' /config/config.js)" ]]; then - sed -i \ - -e "/enableWelcomePage/a\ etherpad_base: '/etherpad/p/'," \ - /config/config.js - fi - - if [[ $ENABLE_TRANSCRIPTIONS -eq 1 || "$ENABLE_TRANSCRIPTIONS" == "true" ]]; then - sed -i \ - -e "s#// transcribingEnabled:.*#transcribingEnabled: true,#" \ - /config/config.js - fi fi if [[ ! -f /config/interface_config.js ]]; then @@ -100,3 +88,7 @@ if [[ ! -f /config/interface_config.js ]]; then fi +# copy app files +if [[ ! -f /config/apple-app-site-configuration ]]; then + cp /defaults/nginx.conf /config/nginx/nginx.conf +fi