фикс: v1.3.3 - устранение 401 Unauthorized, добавлен вызов окна авторизации WWW-Authenticate

This commit is contained in:
Petro1990 2026-03-13 19:34:38 +03:00
parent 32bc5a1494
commit 41ad555e96
1 changed files with 8 additions and 1 deletions

9
rproxy
View File

@ -3,7 +3,7 @@
# Публикация локальных сервисов через SSH-туннели + nginx на VPS
# http://5.104.75.50:3000/Petro1990/rProxy
VERSION="1.3.2"
VERSION="1.3.3"
CONF_DIR="/opt/etc/rproxy"
CONF_FILE="$CONF_DIR/rproxy.conf"
SERVICES_DIR="$CONF_DIR/services"
@ -522,6 +522,11 @@ do_add_interactive() {
proxy_set_header Origin \"http://$router_ip\";
proxy_set_header Referer \"http://$router_ip/\";
}
location @auth_required {
add_header WWW-Authenticate 'Basic realm=\"Keenetic NDM Auth\"' always;
return 401;
}
"
fi
@ -541,6 +546,7 @@ server {
location / {
$( [ "$use_ndm_auth" = "yes" ] && echo "auth_request /rproxy_auth;" )
$( [ "$use_ndm_auth" = "yes" ] && echo "error_page 401 = @auth_required;" )
proxy_pass http://127.0.0.1:$tunnel_port;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;
@ -582,6 +588,7 @@ server {
location / {
$( [ "$use_ndm_auth" = "yes" ] && echo "auth_request /rproxy_auth;" )
$( [ "$use_ndm_auth" = "yes" ] && echo "error_page 401 = @auth_required;" )
proxy_pass http://127.0.0.1:$tunnel_port;
proxy_http_version 1.1;
proxy_set_header Upgrade \$http_upgrade;