Route-handler question
Unanswered
Gharial posted this in #help-forum
GharialOP
Hi, I'm using the NextJS for a green-field frontend project. I love the framework but am running into the following problem.
As part of the architecture, we'd like to use the frontend server as a proxy for all external requests. We want to route any calls to
an open flask server running on the same EC2 instance as our frontend server. However, sometimes my post request would go through but then the
exact same request would give the following error
fetch in the NextJS server but am wondering if this is an issue others have encountered before?
Taking a step back am I following best practices? Thanks!
As part of the architecture, we'd like to use the frontend server as a proxy for all external requests. We want to route any calls to
/api toan open flask server running on the same EC2 instance as our frontend server. However, sometimes my post request would go through but then the
exact same request would give the following error
RequestContentLengthMismatchError . I ended up using node-fetch instead of the nativefetch in the NextJS server but am wondering if this is an issue others have encountered before?
Taking a step back am I following best practices? Thanks!
3 Replies
GharialOP
Also just as a note, rewrites did not work because the redirect request is sent relative to the CLIENT browser, whereas I want the rewrite to be relative to the Next server. I could have misimplemented this however.
this guy might hit the same as urs
https://medium.com/@kaloyan_17221/fix-vercel-next-js-fetch-failed-from-undici-polyfill-8c66346c9c2f
https://medium.com/@kaloyan_17221/fix-vercel-next-js-fetch-failed-from-undici-polyfill-8c66346c9c2f
GharialOP
Yea actually this was the article that made me use node-fetch to resolve my issues.