@@ -525,7 +525,7 @@ change() {
525525 1)
526526 # new port
527527 is_new_port=$3
528- [[ $host && ! $is_caddy ]] && err " ($is_config_file ) 不支持更改端口, 因为没啥意义."
528+ [[ $host && ! $is_caddy || $is_no_auto_tls ]] && err " ($is_config_file ) 不支持更改端口, 因为没啥意义."
529529 if [[ $is_new_port && ! $is_auto ]]; then
530530 [[ ! $( is_test port $is_new_port ) ]] && err " 请输入正确的端口, 可选(1-65535)"
531531 [[ $is_new_port != 443 && $( is_test port_used $is_new_port ) ]] && err " 无法使用 ($is_new_port ) 端口"
@@ -753,7 +753,7 @@ del() {
753753 [[ ! $old_host ]] && return # no host exist or not set new host;
754754 is_del_host=$old_host
755755 }
756- [[ $is_del_host && $host != $old_host ]] && {
756+ [[ $is_del_host && $host != $old_host && ! $is_no_auto_tls ]] && {
757757 rm -rf $is_caddy_conf /$is_del_host .conf $is_caddy_conf /$is_del_host .conf.add
758758 [[ ! $is_new_json ]] && manage restart caddy &
759759 }
@@ -993,7 +993,7 @@ add() {
993993 h2 | ws | grpc)
994994 old_host=$host
995995 if [[ ! $is_use_tls ]]; then
996- host=
996+ unset host is_no_auto_tls
997997 else
998998 [[ $is_old_net == ' grpc' ]] && {
999999 path=/$path
@@ -1246,6 +1246,9 @@ get() {
12461246 if [[ $is_caddy && $host && -f $is_caddy_conf /$host .conf ]]; then
12471247 is_tmp_https_port=$( grep -E -o " $host :[1-9][0-9]?+" $is_caddy_conf /$host .conf | sed s/.* ://)
12481248 fi
1249+ if [[ $host && ! -f $is_caddy_conf /$host .conf ]]; then
1250+ is_no_auto_tls=1
1251+ fi
12491252 [[ $is_tmp_https_port ]] && is_https_port=$is_tmp_https_port
12501253 [[ $is_client && $host ]] && port=$is_https_port
12511254 get protocol $is_protocol -$net
0 commit comments