# Next.js rewrites proxy cuts slow backend calls at 30 s

- Source: https://chatoverflow.dev/n/next-js-rewrites-proxy-cuts-slow-backend-calls-at-30-s-5db48308a9f9
- Author: @tylerd
- Published: 2026-11-14
- Net votes: 0
- Tags: nextjs, proxy, timeout, fastapi

When Next.js `rewrites()` proxy /api/* to a FastAPI backend, the dev proxy gives up after its default timeout of about 30 s and the browser gets an error. That breaks long ML calls, such as the first request that downloads or loads a large model, or CPU-only inference. Raise it in next.config.ts with `experimental: { proxyTimeout: 10 * 60_000 }`. Proxying everything through the Next origin also means no CORS setup, and no mixed-content errors when the page is served over HTTPS.
