CubeLoop — a Pythonic, async-native agent harness core designed for high performance, readability, and production-grade persistence.
Python agent-frameworkagent-harnessagent-runtimeagentic-aiai-agentsai-frameworkanthropicharnessharness-engineeringharness-frameworklanggraphlanggraph-alternativellmmcpopenaipi-agentpi-agent-corepythonpython-agent
fix(site): redirect pages.dev via _worker.js, not a static functions/ dir
Claude47c07cc6336a
diff --git a/website/static/_worker.js b/website/static/_worker.jsnew file mode 100644index 0000000..ed2d996--- /dev/null+++ b/website/static/_worker.js@@ -0,0 +1,33 @@+// Cloudflare Pages "advanced mode" Worker.+//+// The site moved from the default *.pages.dev hostname to the custom domain+// cubepi.ai, but only the root path was redirecting — deep pages still served+// 200 on cubepi.pages.dev (duplicate content on two domains). This 301-redirects+// the production pages.dev hostname to the matching cubepi.ai path so the domain+// migration sends search engines one clean 1:1 signal.+//+// Why _worker.js (advanced mode) and not functions/_middleware.js:+// The site is deployed via Direct Upload (cloudflare/pages-action uploads+// website/build). Cloudflare compiles a _worker.js that sits IN the uploaded+// output directory; a functions/ directory, by contrast, must live at the+// project root where Wrangler runs — placing it under static/ (so it lands in+// build/functions/) makes Cloudflare serve it as a static file, not a Function.+// Docusaurus copies static/_worker.js to build/_worker.js, the deployed dir.+//+// Notes:+// - Matches the production hostname exactly, so preview deployments+// (e.g. <hash>.cubepi.pages.dev) fall through and stay browsable.+// - Everything else is forwarded to env.ASSETS.fetch, which serves the static+// site exactly as Pages would (trailing-slash handling, 404.html, etc.).+export default {+ async fetch(request, env) {+ const url = new URL(request.url);+ if (url.hostname === "cubepi.pages.dev") {+ url.hostname = "cubepi.ai";+ url.protocol = "https:";+ url.port = "";+ return Response.redirect(url.toString(), 301);+ }+ return env.ASSETS.fetch(request);+ },+};diff --git a/website/static/functions/_middleware.js b/website/static/functions/_middleware.jsdeleted file mode 100644index 73440d4..0000000--- a/website/static/functions/_middleware.js+++ /dev/null@@ -1,25 +0,0 @@-// Cloudflare Pages middleware.-//-// The site moved from the default *.pages.dev hostname to the custom domain-// cubepi.ai. This 301-redirects the production pages.dev hostname to the-// canonical domain so the migration sends search engines one clean signal-// (every old URL maps 1:1 to its new path) instead of leaving the old domain-// serving duplicate content.-//-// Notes:-// - Matches the production hostname exactly, so preview deployments-// (e.g. <hash>.cubepi.pages.dev) keep working for review.-// - Runs on every request; cubepi.ai and previews fall through to-// context.next(), so there is no redirect loop.-// - Lives in static/ so Docusaurus copies it to build/functions/, which is-// the directory uploaded to Cloudflare Pages (see .github/workflows/docs.yml).-export async function onRequest(context) {- const url = new URL(context.request.url);- if (url.hostname === "cubepi.pages.dev") {- url.hostname = "cubepi.ai";- url.protocol = "https:";- url.port = "";- return Response.redirect(url.toString(), 301);- }- return context.next();-}