From f294cf4b6e05040dd8c6aa84eff516f2bc916cc9 Mon Sep 17 00:00:00 2001 From: Ivan Razin Date: Wed, 24 Jun 2026 14:24:06 +0300 Subject: [PATCH] Fix subscription page white screen: restore prefix location for deep paths Regex location only matches single-segment paths (subscription IDs). Deep asset paths like /sub_path/static/js/main.js fall through to the prefix location /sub_path/ which proxies them to x-ui sub port normally. Nginx regex > prefix priority ensures Clash UA detection still works for IDs. Co-Authored-By: Claude Sonnet 4.6 --- x-ui-latest.sh | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/x-ui-latest.sh b/x-ui-latest.sh index 064ba90..162f53d 100644 --- a/x-ui-latest.sh +++ b/x-ui-latest.sh @@ -307,18 +307,26 @@ EOF # Shared proxy locations for xray inbounds (included by both vhosts) cat > /etc/nginx/snippets/includes.conf <[^/]*)$ { + location = /${sub_path} { + if (\$hack = 1) { return 404; } + proxy_redirect off; + proxy_set_header Host \$host; + proxy_set_header X-Real-IP \$remote_addr; + proxy_set_header X-Forwarded-For \$proxy_add_x_forwarded_for; + proxy_pass https://127.0.0.1:${sub_port}; + } + # Regex takes priority over prefix: catches subscription IDs (one-level deep) + # and routes Clash/Mihomo clients to dynamic clash.yaml generator + location ~ ^/${sub_path}/(?[^/]+)$ { if (\$hack = 1) { return 404; } if (\$is_clash_client = 1) { rewrite ^ /__clash_api?sub_id=\$clash_sub_id last; } proxy_redirect off;