diff --git a/src/middleware/subdomain.ts b/src/middleware/subdomain.ts index 92ac13d..0ce3679 100644 --- a/src/middleware/subdomain.ts +++ b/src/middleware/subdomain.ts @@ -9,7 +9,7 @@ export default createMiddleware(async (c, next) => { c.set('host', host); if (host == undefined) await next(); - if ((host!.match(/\./g) || []).length > (DOMAIN.match(/\./g) || []).length) { + if ((host!.match(/\./g) || []).length > (DOMAIN.match(/\./g) || []).length && host.includes(DOMAIN)) { try { const blog = await get_blog_domain(host.replace(`.${DOMAIN}`, "")); @@ -19,7 +19,9 @@ export default createMiddleware(async (c, next) => { console.error(e); return c.notFound(); } + } else if (host === DOMAIN) { + await next(); } - await next(); + return c.text("You shouldn't be here!"); }); \ No newline at end of file