demos: Add parameter to redirect demos page to a domain name specified in REDIRECT_INDEX_TO_DOMAIN

This commit is contained in:
cruizba 2022-05-23 15:03:02 +02:00
parent 4bcd06c235
commit b40ecbd9d0
4 changed files with 23 additions and 3 deletions

View File

@ -1,4 +1,4 @@
FROM nginx:1.21.3-alpine
FROM nginx:1.21.6-alpine
# Nginx conf
COPY ./conf/html /var/www/html

View File

@ -6,7 +6,7 @@ server {
listen 80;
server_name _;
root /var/www/html;
{{ no_redirect_to_domain }}
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
@ -21,6 +21,8 @@ server {
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
{{ redirect_index_to_domain }}
location /basic-videoconference {
rewrite /basic-videoconference(.*) /$1 break;
proxy_pass url_ov_basic_videoconference;

View File

@ -16,6 +16,23 @@ sed -i "s|url_ov_classroom|${URL_OV_CLASSROOM}|" /etc/nginx/conf.d/default.conf
sed -i "s|url_ov_getaroom|${URL_OV_GETAROOM}|" /etc/nginx/conf.d/default.conf
sed -i "s|url_ov_call|${URL_OV_CALL}|" /etc/nginx/conf.d/default.conf
cat > /tmp/redirect_index_to_domain.tpl <<EOL
location / {
rewrite ^/$ {{ redirect_domain }} redirect;
}
EOL
if [ -n "${REDIRECT_INDEX_TO_DOMAIN}" ]; then
sed -i '/{{ no_redirect_to_domain }}/d' /etc/nginx/conf.d/default.conf
sed -i "s|{{ redirect_domain }}|${REDIRECT_INDEX_TO_DOMAIN}|" /tmp/redirect_index_to_domain.tpl
sed -e '/{{ redirect_index_to_domain }}/{r /tmp/redirect_index_to_domain.tpl' -e 'd}' -i /etc/nginx/conf.d/default.conf
rm /tmp/redirect_index_to_domain.tpl
else
sed -i "s|{{ no_redirect_to_domain }}|root /var/www/html;|" /etc/nginx/conf.d/default.conf
sed -i '/{{ redirect_index_to_domain }}/d' /etc/nginx/conf.d/default.conf
rm /tmp/redirect_index_to_domain.tpl
fi
# Run nginx
nginx -g "daemon off;"

View File

@ -46,7 +46,7 @@ services:
- CALL_OPENVIDU_CERTTYPE=${CERTIFICATE_TYPE}
demos-page:
image: openvidu/openvidu-demo-proxy:1.1.0
image: openvidu/openvidu-demo-proxy:2.22.0
restart: on-failure
ports:
- "5442:80"
@ -57,3 +57,4 @@ services:
- URL_OV_CLASSROOM=https://openvidu-classroom:5000
- URL_OV_GETAROOM=http://openvidu-getaroom:80
- URL_OV_CALL=http://openvidu-call:5000
- REDIRECT_INDEX_TO_DOMAIN=${REDIRECT_INDEX_TO_DOMAIN:-}