Migrate django application to nextjs

I want to migrate an old django application to nextjs incrementally, and I struggle to have the same behavior with my URLS. Is there any option to provide to next.config.mjs so next doesn't change the URL at all, and doesn't try to add or remove slashes? With the current django app: * localhost:9400/auth/login -> HTTP 301 to /auth/login/ * localhost:9400/auth/login/ -> HTTP 200 * localhost:9400/dashboards/ -> HTTP 404 * localhost:9400/dashboard -> HTTP 200 With the following configuration in next.config.mjs, a call to localhost:3000/auth/login/ returns HTTP/308 to /auth/login.
async rewrites() {
return {
beforeFiles: [],
afterFiles: [],
fallback: [
{
source: "/:path*",
destination: "http://localhost:9400/:path*",
},
],
}
async rewrites() {
return {
beforeFiles: [],
afterFiles: [],
fallback: [
{
source: "/:path*",
destination: "http://localhost:9400/:path*",
},
],
}
If I add skipTrailingSlashRedirect: true, to next.config.mjs, then localhost:3000/auth/login/ queries django to /auth/login (the extra slash is removed), django returns HTTP/301 to /auth/login/ which is returned to the client by nextjs. I can't find the correct config to provide to next :/
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server