proxy.ts has no matcher and logs each request. What does it print when you open the home page, scroll to a link, and click it?
Leaf and Kettle's proxy.ts has no config, so no matcher, and logs every request it runs for, giving every file under /_next/static the same line. The home page has a link to the tea list far down the page. You build and start the app, open / in Chrome, scroll down to the link, and click it. What does the terminal print?
proxy.tsimport type { NextRequest } from "next/server";
export function proxy(request: NextRequest) {
const { pathname } = request.nextUrl;
// Next.js's built files get a line each, without their long names.
const what = pathname.startsWith("/_next/static/") ? "a file from /_next/static" : pathname;
console.log(`proxy.ts ran for ${what}`);
}
app/layout.tsxexport const metadata = { title: "Leaf and Kettle" };
export default function RootLayout({ children }: LayoutProps<"/">) {
return (
<html lang="en">
<body>{children}</body>
</html>
);
}
app/page.tsximport Link from "next/link";
export default function Home() {
return (
<main>
<h1>Leaf and Kettle</h1>
<p>Loose-leaf tea, packed by hand.</p>
{/* The rest of the home page, which pushes the link far below the first screen. */}
<div style={{ height: 2000 }} />
<Link href="/teas">See our teas</Link>
</main>
);
}
app/teas/page.tsxexport default function TeasPage() {
return (
<main>
<h1>Our teas</h1>
<ul>
<li>Green tea</li>
<li>Mint tea</li>
<li>Oolong tea</li>
</ul>
</main>
);
}
It's a project create-next-app made (Next.js 16.4.3, TypeScript, the App Router, and Cache Components on) with these files, built with next build and run with next start. What happens:
- You run
next buildandnext start. - You open
/in Chrome. - You scroll down to the See our teas link and wait until the network is quiet.
- You click See our teas.
The answer
Work out what Next.js does at each step: what the build prints, what each request answers, and what the page shows. Then check.
Checking your sign-in…