Skip to main content

NextJS (fetch)

Capture HTTPS requests from Next.js server-side fetch() and Server Components with the Proxyman pre-configured Terminal from Automatic Setup.

1. Problem​

  • Proxyman can't capture any traffic from use server code in NextJS
  • It's because fetch in NextJS doesn't respect the system HTTP proxy. Therefore, no traffic goes through the Proxyman app.

2. Solution​

  1. Start the pre-configured Terminal: Setup menu -> Automatic Setup -> Click "Open New Terminal"
  2. A new Terminal opens -> Start your NextJS server in this Terminal. For example: npm run dev
  3. Use no-cache on fetch
export default async function MyPage() {
const res = await fetch('https://httpbin.org/anything', { cache: 'no-cache' }) // no cache, or no request is sent to Proxyman
return <div>My Page{res.text()}</div>
}
  1. Reload your website
  2. Done ✅ The Proxyman app captures your HTTP traffic
Next.js dev server in the Proxyman pre-configured Terminal and the captured server-side fetch requests in Proxyman

Capture NextJS fetch on Proxyman

3. Reference:​

Learn more​