Open npa-axelor opened 3 months ago
Hi, Next.js rewrites is not a proxy but handles request paths under the hood. Therefore I recommend you to use other proxy utils.
I have a question as I am dealing with a similar problem. App1 (Next.js) uses rewrite to connect to the backend API server. I thought this would help prevent CORS, but it does. How is the appropriate way to handle this?
Hi, Next.js rewrites is not a proxy but handles request paths under the hood. Therefore I recommend you to use other proxy utils.
Is there any recommendation method, rewrites have been used to process the interface agent in NEXT13.but NEXT14 will not work
Link to the code that reproduces this issue
https://github.com/npa-axelor/app-router-rewrites
To Reproduce
<Link href='/app2'>App2</Link>
rewrites in app1 next.config.js
async rewrites() { return [ { source: "/app2", destination: `http://localhost:3001/app2`, }]; }
Current vs. Expected behavior
After clicking on the link, the url changes to /app2. However the page is not rendered with App2 content.
Only after refreshing the page it shows the content of App2.
Provide environment information
Which area(s) are affected? (Select all that apply)
App Router, Routing (next/router, next/navigation, next/link)
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
No response