From aace6c4361fa54837d1855c38fd105cc3ebef1bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EB=B3=80=EC=B0=AC=EC=9A=B0?= Date: Fri, 6 Sep 2024 12:49:28 +0900 Subject: [PATCH] fix: update api header host on Route API --- packages/app/src/pages/api/server/[...params].ts | 4 ++++ packages/app/src/pages/api/server/file/image.ts | 1 + packages/app/src/pages/api/server/file/index.ts | 1 + packages/app/src/pages/api/server/student/pdf.ts | 1 + 4 files changed, 7 insertions(+) diff --git a/packages/app/src/pages/api/server/[...params].ts b/packages/app/src/pages/api/server/[...params].ts index 402ab9ac..751dcac0 100644 --- a/packages/app/src/pages/api/server/[...params].ts +++ b/packages/app/src/pages/api/server/[...params].ts @@ -9,6 +9,7 @@ export default withHandler({ if (access) { const apiRes = await serverApi({ + baseURL: process.env.SERVER_URL, url, method: req.method, data: ['GET', 'DELETE', 'HEAD'].includes(req.method || '') @@ -16,6 +17,7 @@ export default withHandler({ : req.body, headers: { ...req.headers, + host: process.env.SERVER_URL?.replace('https://', ''), Authorization: `Bearer ${access}`, }, }) @@ -24,6 +26,7 @@ export default withHandler({ } const apiRes = await serverApi({ + baseURL: process.env.SERVER_URL, url, method: req.method, data: ['GET', 'DELETE', 'HEAD'].includes(req.method || '') @@ -31,6 +34,7 @@ export default withHandler({ : req.body, headers: { ...req.headers, + host: process.env.SERVER_URL?.replace('https://', ''), }, }) diff --git a/packages/app/src/pages/api/server/file/image.ts b/packages/app/src/pages/api/server/file/image.ts index 1cf8adea..e047c7fe 100644 --- a/packages/app/src/pages/api/server/file/image.ts +++ b/packages/app/src/pages/api/server/file/image.ts @@ -29,6 +29,7 @@ export default withHandler({ data: formData, headers: { ...req.headers, + host: process.env.SERVER_URL?.replace('https://', ''), Authorization: `Bearer ${accessToken}`, }, }) diff --git a/packages/app/src/pages/api/server/file/index.ts b/packages/app/src/pages/api/server/file/index.ts index 033528c5..fa1ac9b6 100644 --- a/packages/app/src/pages/api/server/file/index.ts +++ b/packages/app/src/pages/api/server/file/index.ts @@ -29,6 +29,7 @@ export default withHandler({ data: formData, headers: { ...req.headers, + host: process.env.SERVER_URL?.replace('https://', ''), Authorization: `Bearer ${accessToken}`, }, }) diff --git a/packages/app/src/pages/api/server/student/pdf.ts b/packages/app/src/pages/api/server/student/pdf.ts index 60ae521c..104d2149 100644 --- a/packages/app/src/pages/api/server/student/pdf.ts +++ b/packages/app/src/pages/api/server/student/pdf.ts @@ -29,6 +29,7 @@ export default withHandler({ data: formData, headers: { ...req.headers, + host: process.env.SERVER_URL?.replace('https://', ''), Authorization: `Bearer ${accessToken}`, }, })