From 12544159e9351b8c107571a2f99f6dc5c5afb601 Mon Sep 17 00:00:00 2001 From: Petro1990 Date: Fri, 13 Mar 2026 19:45:16 +0300 Subject: [PATCH] =?UTF-8?q?=D1=84=D0=B8=D0=BA=D1=81:=20v1.3.5=20-=20=D1=83?= =?UTF-8?q?=D1=81=D1=82=D1=80=D0=B0=D0=BD=D0=B5=D0=BD=D0=B8=D0=B5=20=D0=B1?= =?UTF-8?q?=D0=B5=D1=81=D0=BA=D0=BE=D0=BD=D0=B5=D1=87=D0=BD=D0=BE=D0=B3?= =?UTF-8?q?=D0=BE=20=D1=86=D0=B8=D0=BA=D0=BB=D0=B0=20=D0=BF=D0=B0=D1=80?= =?UTF-8?q?=D0=BE=D0=BB=D1=8F=20=D1=87=D0=B5=D1=80=D0=B5=D0=B7=20Clean=20A?= =?UTF-8?q?uth=20=D0=B8=20X-Requested-With?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- rproxy | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/rproxy b/rproxy index 781b25d..12f524f 100644 --- a/rproxy +++ b/rproxy @@ -3,7 +3,7 @@ # Публикация локальных сервисов через SSH-туннели + nginx на VPS # http://5.104.75.50:3000/Petro1990/rProxy -VERSION="1.3.4" +VERSION="1.3.5" CONF_DIR="/opt/etc/rproxy" CONF_FILE="$CONF_DIR/rproxy.conf" SERVICES_DIR="$CONF_DIR/services" @@ -179,9 +179,13 @@ next_free_port() { get_router_ip() { # Метод 1: Через ndmq (Keenetic Bridge0) local ip=$(ndmq -p "show interface Bridge0" -path "address" 2>/dev/null) + [ -n "$ip" ] && [ "$ip" != "0.0.0.0" ] && echo "$ip" && return + + # Метод 2: Через маршруты (default gateway) + ip=$(ip route show | grep default | awk '{print $3}' | head -n 1) [ -n "$ip" ] && echo "$ip" && return - # Метод 2: Через ip addr (Entware/Keenetic) + # Метод 3: Через ip addr (Entware/Keenetic) ip=$(ip addr show br0 2>/dev/null | grep 'inet ' | awk '{print $2}' | cut -d/ -f1 | head -n1) [ -n "$ip" ] && echo "$ip" && return @@ -197,6 +201,8 @@ enable_router_basic_auth() { ndmq -p "ip http auth basic" >/dev/null 2>&1 # Принудительно задаем realm ndmq -p "web-server realm Keenetic" >/dev/null 2>&1 + # ОЧЕНЬ ВАЖНО: Сохраняем конфигурацию + ndmq -p "system configuration save" >/dev/null 2>&1 } next_free_ext_port() { @@ -535,6 +541,10 @@ do_add_interactive() { proxy_set_header Origin \"http://$router_ip\"; proxy_set_header Referer \"http://$router_ip/\"; proxy_set_header X-NDM-Realm \"Keenetic\"; + proxy_set_header X-Requested-With XMLHttpRequest; + + # Скрываем заголовки роутера, чтобы они не конфликтовали с нашими + proxy_hide_header WWW-Authenticate; } location @auth_required {