deployment: separated rules for dashboard/ and inspector/ in openvidu-proxy

To fix a rule in OpenVidu Enterprise to redirect `<domain>/inspector` to `<domain>/inspector/`,
now dashboard and inspector rules are separated to have different configurations
depending on the OpenVidu Edition PRO or Enterprise
pull/809/head
cruizba 2023-06-16 13:49:31 +02:00
parent fb6df7773a
commit 946be88928
5 changed files with 38 additions and 13 deletions

View File

@ -1,6 +1,8 @@
################################# #################################
# Common rules Enterprise # # Common rules Enterprise #
################################# #################################
{dashboard_inspector_rules_enterprise}
location /minio/ { location /minio/ {
{rules_access_dashboard} {rules_access_dashboard}
deny all; deny all;

View File

@ -0,0 +1,13 @@
location /dashboard {
{rules_access_dashboard}
deny all;
rewrite ^/dashboard/(.*)$ /$1 break;
proxy_pass http://openviduserver/;
}
location /inspector {
{rules_access_dashboard}
deny all;
rewrite ^([^.]*[^/])$ $1/ permanent;
proxy_pass http://openviduserver;
}

View File

@ -1,18 +1,7 @@
################################# #################################
# Common rules PRO # # Common rules PRO #
################################# #################################
location /dashboard { {dashboard_inspector_rules_pro}
{rules_access_dashboard}
deny all;
rewrite ^/dashboard/(.*)$ /$1 break;
proxy_pass http://openviduserver/;
}
location /inspector {
{rules_access_dashboard}
deny all;
proxy_pass http://openviduserver;
}
location /kibana { location /kibana {
{rules_access_dashboard} {rules_access_dashboard}

View File

@ -0,0 +1,12 @@
location /dashboard {
{rules_access_dashboard}
deny all;
rewrite ^/dashboard/(.*)$ /$1 break;
proxy_pass http://openviduserver/;
}
location /inspector {
{rules_access_dashboard}
deny all;
proxy_pass http://openviduserver;
}

View File

@ -296,7 +296,10 @@ elif [[ "${REDIRECT_WWW}" == "false" ]]; then
sed -i '/{redirect_www_ssl}/d' /etc/nginx/conf.d/* sed -i '/{redirect_www_ssl}/d' /etc/nginx/conf.d/*
fi fi
if [[ "${PROXY_MODE}" == "ENTERPRISE_HA" ]]; then if [[ "${PROXY_MODE}" == "PRO" ]]; then
# Add dashboad and inspector rules
sed -e '/{dashboard_inspector_rules_pro}/{r default_nginx_conf/global/pro/dashboard_inspector_rules_pro.conf' -e 'd}' -i /etc/nginx/conf.d/*
elif [[ "${PROXY_MODE}" == "ENTERPRISE_HA" ]]; then
TEMP_FILE_UPSTREAM=$(mktemp) TEMP_FILE_UPSTREAM=$(mktemp)
# Create upstream nodes # Create upstream nodes
@ -318,6 +321,12 @@ if [[ "${PROXY_MODE}" == "ENTERPRISE_HA" ]]; then
# Add upstream nodes to nginx config # Add upstream nodes to nginx config
sed -e '/{enterprise_ha_nodes_upstream}/{r '"${TEMP_FILE_UPSTREAM}"'' -e 'd}' -i /etc/nginx/conf.d/* sed -e '/{enterprise_ha_nodes_upstream}/{r '"${TEMP_FILE_UPSTREAM}"'' -e 'd}' -i /etc/nginx/conf.d/*
# Add dashboad and inspector rules
# 1. First remove pro rules
sed -i '/{dashboard_inspector_rules_pro}/d' /etc/nginx/conf.d/*
# 2. Add enterprise rules
sed -e '/{dashboard_inspector_rules_enterprise}/{r default_nginx_conf/global/enterprise-ha/dashboard_inspector_rules_enterprise.conf' -e 'd}' -i /etc/nginx/conf.d/*
fi fi
# Process main configs # Process main configs