summaryrefslogtreecommitdiff
path: root/cgithub/src
diff options
context:
space:
mode:
authorJoe Mou <dev@mou.fo>2026-01-26 13:41:55 -0500
committerJoe Mou <dev@mou.fo>2026-01-26 13:42:17 -0500
commitd91b89f89bd7dcf3258dc5802d6a97c5e341e272 (patch)
treeb8c99c66d08db65fbcf60945b702d072ad3033ce /cgithub/src
parent6484840a5412de4b003f9007eadf3e120dae5f3c (diff)
Redirect any unhandled routes to GitHub
Diffstat (limited to 'cgithub/src')
-rw-r--r--cgithub/src/index.ts6
1 files changed, 6 insertions, 0 deletions
diff --git a/cgithub/src/index.ts b/cgithub/src/index.ts
index 15d464a..38d6d13 100644
--- a/cgithub/src/index.ts
+++ b/cgithub/src/index.ts
@@ -41,6 +41,12 @@ app.get("/:owner/:repo/raw/:branch/:path{.*}", async (c) => {
return c.redirect(`https://raw.githubusercontent.com/${owner}/${repo}/${branch}/${path}`);
});
+app.all("*", async (c) => {
+ const path = c.req.path;
+ c.header("Referrer-Policy", "no-referrer");
+ return c.redirect(`https://github.com${path}`);
+});
+
if (process.env.LISTEN_FDS === "1") {
const server = createAdaptorServer(app);
// Listen on SD_LISTEN_FDS_START.