mirror of
https://github.com/Moe-Sakura/Wrangler-API.git
synced 2026-04-22 22:10:04 +08:00
feat: 添加根路径重定向与日志增强
* 在根路径 '/' 访问时,自动重定向到主页 'https://searchgal.homes'。 * 在 `logToCF` 函数中添加 `console.log`,方便在 Cloudflare 控制台查看日志。
This commit is contained in:
@@ -54,6 +54,10 @@ export default {
|
||||
async fetch(request: Request, env: Env, ctx: ExecutionContext): Promise<Response> {
|
||||
const url = new URL(request.url);
|
||||
|
||||
if (url.pathname === '/') {
|
||||
return Response.redirect('https://searchgal.homes', 302);
|
||||
}
|
||||
|
||||
if (request.method === "OPTIONS") {
|
||||
return new Response(null, { headers: corsHeaders });
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user