From adb860b4646c0c7548a059c5a8e8b3349ebdeca8 Mon Sep 17 00:00:00 2001 From: Yidadaa Date: Tue, 19 Sep 2023 02:12:43 +0800 Subject: [PATCH 1/2] fix: #2820 try to fix 520 error code --- app/api/cors/[...path]/route.ts | 9 +++++++-- app/components/settings.tsx | 2 +- app/locales/cn.ts | 1 + app/locales/en.ts | 1 + app/utils/cloud/webdav.ts | 2 +- 5 files changed, 11 insertions(+), 4 deletions(-) diff --git a/app/api/cors/[...path]/route.ts b/app/api/cors/[...path]/route.ts index 90404cf8..1f70d663 100644 --- a/app/api/cors/[...path]/route.ts +++ b/app/api/cors/[...path]/route.ts @@ -26,13 +26,18 @@ async function handle( duplex: "half", }; - console.log("[Any Proxy]", targetUrl); + const fetchResult = await fetch(targetUrl, fetchOptions); - const fetchResult = fetch(targetUrl, fetchOptions); + console.log("[Any Proxy]", targetUrl, { + status: fetchResult.status, + statusText: fetchResult.statusText, + }); return fetchResult; } export const POST = handle; +export const GET = handle; +export const OPTIONS = handle; export const runtime = "edge"; diff --git a/app/components/settings.tsx b/app/components/settings.tsx index 8e43e1d1..fb1d688f 100644 --- a/app/components/settings.tsx +++ b/app/components/settings.tsx @@ -275,7 +275,7 @@ function CheckButton() { return ( Date: Tue, 19 Sep 2023 02:21:31 +0800 Subject: [PATCH 2/2] fixup --- app/api/cors/[...path]/route.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/cors/[...path]/route.ts b/app/api/cors/[...path]/route.ts index 1f70d663..0217b12b 100644 --- a/app/api/cors/[...path]/route.ts +++ b/app/api/cors/[...path]/route.ts @@ -40,4 +40,4 @@ export const POST = handle; export const GET = handle; export const OPTIONS = handle; -export const runtime = "edge"; +export const runtime = "nodejs";