Skip to content

armgit / dbx

Public Imported from GitHub
0

25 MB lightweight cross-platform database client for 100+ databases, including MySQL, PostgreSQL, SQLite, Redis, MongoDB, DuckDB, SQL Server, and Dameng. Built-in AI, MCP Server, CLI, desktop and Docker. | 轻量级跨平台数据库管理工具,支持 MySQL、PostgreSQL、SQLite、Redis、MongoDB、达梦等 100+ 数据库,提供桌面端、Docker、CLI、内置 AI 助手和 MCP。

fix(web): serve index.html at base path root for subpath deploy

Ez142ccb175f39
diff --git a/crates/dbx-web/src/main.rs b/crates/dbx-web/src/main.rs
index bb4d9c84dd..56b2b41c1c 100644
--- a/crates/dbx-web/src/main.rs
+++ b/crates/dbx-web/src/main.rs
@@ -799,6 +799,14 @@ async fn main() {
if public_base_path != "/" {
app = Router::new().nest(&public_base_path, app);
+ // axum 的 nest 不匹配“子路径根目录”(带尾斜杠,如 /dbx/),导致子路径部署时首页 404。
+ // 在 nest 外层显式把根目录挂到 index.html,浏览器地址栏保持 /dbx/ 不变,
+ // 相对资源与前端路径推断都依赖这个 URL 形态。见 issue #5518。
+ if let Ok(static_dir) = std::env::var("DBX_STATIC_DIR") {
+ use tower_http::services::ServeFile;
+ let index_path = format!("{static_dir}/index.html");
+ app = app.route_service(&format!("{public_base_path}/"), ServeFile::new(index_path));
+ }
}
// Bind address