diff --git a/src/core.sh b/src/core.sh index be97ea3..31dd05e 100644 --- a/src/core.sh +++ b/src/core.sh @@ -172,6 +172,11 @@ update_caddyfile_fallback() { # Prepend a new global block at the very top of the Caddyfile echo -e "{\n https_port 4443\n}\n$(cat $is_caddyfile)" >$is_caddyfile fi + + # 4. Replace any explicit :443 in other conf files inside /etc/caddy/sing-box/ + if [[ -d /etc/caddy/sing-box ]]; then + sed -i 's/:443\b/:4443/g' /etc/caddy/sing-box/*.conf 2>/dev/null + fi } install_haproxy() { @@ -197,6 +202,12 @@ restore_caddy_default() { sed -i 's/:4443[[:space:]]*{/:443 {/g' $is_caddyfile sed -i 's/https_port 4443/https_port 443/g' $is_caddyfile fi + + # Restore explicit :4443 in other conf files inside /etc/caddy/sing-box/ + if [[ -d /etc/caddy/sing-box ]]; then + sed -i 's/:4443\b/:443/g' /etc/caddy/sing-box/*.conf 2>/dev/null + fi + systemctl restart caddy >/dev/null 2>&1 }