diff --git a/confs/site/reverse-proxy.conf b/confs/site/reverse-proxy.conf index bc12a78..ed4b4a5 100644 --- a/confs/site/reverse-proxy.conf +++ b/confs/site/reverse-proxy.conf @@ -1,3 +1,4 @@ location %REVERSE_PROXY_URL% { proxy_pass %REVERSE_PROXY_HOST%; + %REVERSE_PROXY_WS% } diff --git a/entrypoint/site-config.sh b/entrypoint/site-config.sh index 56f234a..9923b1a 100644 --- a/entrypoint/site-config.sh +++ b/entrypoint/site-config.sh @@ -53,9 +53,16 @@ if [ "$USE_REVERSE_PROXY" = "yes" ] ; then value=$(echo "$var" | sed "s/${name}=//") host=$(echo "$name" | sed "s/URL/HOST/") host_value=$(env | grep "^${host}=" | sed "s/${host}=//") + ws=$(echo "$name" | sed "s/URL/WS/") + ws_value=$(env | grep "^${ws}=" | sed "s/${ws}=//") cp "${NGINX_PREFIX}reverse-proxy.conf" "${NGINX_PREFIX}reverse-proxy-${i}.conf" replace_in_file "${NGINX_PREFIX}reverse-proxy-${i}.conf" "%REVERSE_PROXY_URL%" "$value" replace_in_file "${NGINX_PREFIX}reverse-proxy-${i}.conf" "%REVERSE_PROXY_HOST%" "$host_value" + if [ "$ws_value" = "yes" ] ; then + replace_in_file "${NGINX_PREFIX}reverse-proxy-${i}.conf" "%REVERSE_PROXY_WS%" "proxy_http_version 1.1;\nproxy_set_header Upgrade \$http_upgrade;\nproxy_set_header Connection \$connection_upgrade;\n" + else + replace_in_file "${NGINX_PREFIX}reverse-proxy-${i}.conf" "%REVERSE_PROXY_WS%" "" + fi i=$(($i + 1)) fi done