Next.js · Senior · Question 70 of 75
Why should proxy.ts do only optimistic auth checks?
- ✓Correct answer: It runs on many requests including prefetches, so it should read the session cookie, not query the database; real checks belong near the data
- 2
proxy.tscan't read cookies - 3Redirects from proxy are cached forever
Explanation
Slow checks in proxy delay every navigation. A data access layer that verifies the session before reading data is the source of truth.