nginx: avoid proxy_pass to hosts other than JVB

pull/1175/head
Aaron van Meerten 3 years ago
parent a8a596bd6f
commit f873cda197
  1. 3
      web/rootfs/defaults/meet.conf
  2. 6
      web/rootfs/etc/cont-init.d/10-config

@ -1,5 +1,6 @@
{{ $ENABLE_COLIBRI_WEBSOCKET := .Env.ENABLE_COLIBRI_WEBSOCKET | default "1" | toBool }}
{{ $ENABLE_XMPP_WEBSOCKET := .Env.ENABLE_XMPP_WEBSOCKET | default "1" | toBool }}
{{ $WS_SERVER_ID := .Env.JVB_WS_SERVER_ID | default .Env.JVB_WS_SERVER_ID_FALLBACK -}}
server_name _;
@ -48,7 +49,7 @@ location ~ ^/(libs|css|static|images|fonts|lang|sounds|connection_optimization|.
{{ if $ENABLE_COLIBRI_WEBSOCKET }}
# colibri (JVB) websockets
location ~ ^/colibri-ws/([a-zA-Z0-9-\.]+)/(.*) {
proxy_pass http://$1:9090/colibri-ws/$1/$2$is_args$args;
proxy_pass http://{{ $WS_SERVER_ID }}:9090/colibri-ws/$1/$2$is_args$args;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";

@ -63,6 +63,12 @@ if [[ $DISABLE_HTTPS -ne 1 ]]; then
fi
fi
# On environments like Swarm the IP address used by the default gateway need not be
# the one used for inter-container traffic. Use that one for our fallback ID.
XMPP_SERVER_IP=$(dig +short ${XMPP_SERVER})
# export this here to ensure JVB and nginx are in sync about websocket proxy host
export JVB_WS_SERVER_ID_FALLBACK=$(ip route get ${XMPP_SERVER_IP} | grep -oP '(?<=src ).*' | awk '{ print $1 '})
# copy config files
tpl /defaults/nginx.conf > /config/nginx/nginx.conf

Loading…
Cancel
Save