Quiz: Route Handlers, Proxy and Authentication
Explore how to structure API routes, manage proxy rewrites versus redirects for access control, and implement authentication in Next.js applications. Learn to design endpoints and choose routing strategies for secure, flexible features.
Multiple choice questions
What is the fundamental difference between NextResponse.rewrite() and NextResponse.redirect() in Next.js middleware?
rewrite serves content from a different path without changing the URL, while redirect sends the browser to a new URL.
rewrite changes the URL in the browser’s address bar, while redirect serves different content for the same URL.
rewrite is used for permanent URL changes (308 status), while redirect is for temporary changes (307 status).
rewrite can only be used with the matcher config, while redirect works for all routes by default.
Matching exercise
Match the NextAuth.js concept ...