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(site): route worker API paths ahead of static 404 handling

t8y2197ba97f73c5
diff --git a/docs/worker.ts b/docs/worker.ts
index 6b6eefcf7c..e656080ada 100644
--- a/docs/worker.ts
+++ b/docs/worker.ts
@@ -645,6 +645,9 @@ export default {
if (url.pathname === "/api/auth/me" && request.method === "GET") return currentUser(request, env);
if (url.pathname === "/api/auth/logout" && request.method === "POST") return logout();
if (url.pathname === "/api/contributor-avatar" && request.method === "GET") return contributorAvatar(request);
+ // API paths must never fall through to the cached HTML 404 page: a navigation to an
+ // unmatched /api route would otherwise be edge-cached and shadow this worker.
+ if (url.pathname.startsWith("/api/")) return json({ error: "NOT_FOUND" }, 404);
const response = await env.ASSETS.fetch(request);
if (response.status === 404) {
const shellRequest = pluginDetailShellRequest(url, request);
diff --git a/docs/wrangler.json b/docs/wrangler.json
index 0b53c1c2af..7727b9eb0e 100644
--- a/docs/wrangler.json
+++ b/docs/wrangler.json
@@ -5,7 +5,20 @@
"assets": {
"directory": "./out",
"binding": "ASSETS",
- "not_found_handling": "404-page"
+ "not_found_handling": "404-page",
+ "run_worker_first": [
+ "/api/*",
+ "/tr",
+ "/tr/*",
+ "/issue",
+ "/issue/",
+ "/issues",
+ "/issues/",
+ "/cn/issues",
+ "/cn/issues/",
+ "/en/issues",
+ "/en/issues/"
+ ]
},
"r2_buckets": [
{