Open ShaulBenDavid opened 1 month ago
https://github.com/ShaulBenDavid/my-tubes-frontend
config rewrites
rewrites: async () => [ { source: "/api/:path*",
destination: ${process.env.NEXT_PUBLIC_MY_TUBES_URL}:path*, }, ],
${process.env.NEXT_PUBLIC_MY_TUBES_URL}:path*
get infinite loop
successful api request
Operating System: Platform: darwin Arch: arm64 Version: Darwin Kernel Version 23.4.0: Fri Mar 15 00:10:42 PDT 2024; root:xnu-10063.101.17~1/RELEASE_ARM64_T6000 Binaries: Node: 18.17.1 npm: 9.6.7 Yarn: 1.22.19 pnpm: N/A Relevant Packages: next: 14.1.2 eslint-config-next: 14.1.2 react: 18.2.0 react-dom: 18.2.0 typescript: 5.0.3 Next.js Config: output: N/A
Runtime
next dev (local)
I have the same config when my backend is Express js and everything works perfect the problem is when the backend is Django rest
Got the same issue. Just fixed it by appending a slash to the destination url.
Hi I recently faced the same problem and wrote a blog post about it, which includes some solutions that worked for me. I hope it helps you as well! You can check it out here
Link to the code that reproduces this issue
https://github.com/ShaulBenDavid/my-tubes-frontend
To Reproduce
config rewrites
rewrites: async () => [ { source: "/api/:path*",
destination:
${process.env.NEXT_PUBLIC_MY_TUBES_URL}:path*
, }, ],get infinite loop
Current vs. Expected behavior
successful api request
Provide environment information
Which area(s) are affected? (Select all that apply)
Runtime
Which stage(s) are affected? (Select all that apply)
next dev (local)
Additional context
I have the same config when my backend is Express js and everything works perfect the problem is when the backend is Django rest