mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-12-03 21:18:19 +07:00
[PR #5536] [MERGED] fix(web): serve panel SPA routes from NoRoute #5914
Labels
No labels
backlog
bug
clarification needed
documentation
duplicate
enhancement
github_actions
good first issue
invalid
javascript
New Feature
PR welcomed
pull-request
question
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
MHSanaei/3x-ui#5914
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/MHSanaei/3x-ui/pull/5536
Author: @w3struk
Created: 6/24/2026
Status: ✅ Merged
Merged: 6/24/2026
Merged by: @MHSanaei
Base:
main← Head:fix/spa-panel-routes📝 Commits (5)
c0c8020fix(web): serve panel SPA routes from NoRoute4a5d2acfix(web): remove unreachable panel path guardaf6d8d8Merge branch 'main' into fix/spa-panel-routes4d8a989Merge branch 'main' into fix/spa-panel-routese54200afix(web): allowlist static-asset extensions in SPA fallback📊 Changes
4 files changed (+320 additions, -7 deletions)
View changed files
📝
internal/web/controller/dist.go(+6 -6)📝
internal/web/controller/spa.go(+81 -0)➕
internal/web/controller/spa_test.go(+228 -0)📝
internal/web/web.go(+5 -1)📄 Description
Summary
NoRouteso client-side routes like/panel/hostssurvive page refreshes/panel/api,/panel/csrf-token, non-HTML accepts, non-GET requests, and static-file misses out of the SPA fallbackWhy
The frontend already registers the Hosts page, but the backend used a manual list of SPA GET routes. When the panel runs under a base path, refreshing
/admin-*/panel/hostsmissed that list and fell through to the global 404 handler.Testing
docker run --rm -v "$PWD":/app -w /app/frontend node:22-alpine sh -c 'npm ci && npm run build'docker run --rm -v "$PWD":/app -v /tmp/go-build-cache:/root/.cache/go-build -v /tmp/go-mod-cache:/go/pkg/mod -w /app golang:1.26-alpine sh -c 'apk add --no-cache build-base >/dev/null && CGO_ENABLED=1 go build ./... && CGO_ENABLED=1 go test ./...'ghcr.io/w3struk/3x-ui:spa-hosts-routing-20260624/admin-w79p/panel/hostsworks from that Docker image🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.