Skip to content

Commit

Permalink
[#362] api host 문제 해결 (#365) (#366)
Browse files Browse the repository at this point in the history
  • Loading branch information
chanwoo00106 authored Sep 6, 2024
1 parent 7523b62 commit 41e54fe
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 0 deletions.
4 changes: 4 additions & 0 deletions packages/app/src/pages/api/server/[...params].ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,15 @@ 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 || '')
? undefined
: req.body,
headers: {
...req.headers,
host: process.env.SERVER_URL?.replace('https://', ''),
Authorization: `Bearer ${access}`,
},
})
Expand All @@ -24,13 +26,15 @@ export default withHandler({
}

const apiRes = await serverApi({
baseURL: process.env.SERVER_URL,
url,
method: req.method,
data: ['GET', 'DELETE', 'HEAD'].includes(req.method || '')
? undefined
: req.body,
headers: {
...req.headers,
host: process.env.SERVER_URL?.replace('https://', ''),
},
})

Expand Down
1 change: 1 addition & 0 deletions packages/app/src/pages/api/server/file/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default withHandler({
data: formData,
headers: {
...req.headers,
host: process.env.SERVER_URL?.replace('https://', ''),
Authorization: `Bearer ${accessToken}`,
},
})
Expand Down
1 change: 1 addition & 0 deletions packages/app/src/pages/api/server/file/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default withHandler({
data: formData,
headers: {
...req.headers,
host: process.env.SERVER_URL?.replace('https://', ''),
Authorization: `Bearer ${accessToken}`,
},
})
Expand Down
1 change: 1 addition & 0 deletions packages/app/src/pages/api/server/student/pdf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export default withHandler({
data: formData,
headers: {
...req.headers,
host: process.env.SERVER_URL?.replace('https://', ''),
Authorization: `Bearer ${accessToken}`,
},
})
Expand Down

0 comments on commit 41e54fe

Please sign in to comment.