# Strapi plus Next App Router, where does the Croct proxy go and how do I keep my own middleware?

Asked by Kevin O'Neil on 2026-11-13. Tags: strapi, nextjs, proxy.

My Strapi-backed site runs on the Next App Router and I already have custom
middleware for auth. I followed an older tutorial that mentioned a Croct middleware
export I could not find it anywhere in the current package, and now I am not sure
how the setup works or how to avoid clobbering the middleware I already have.

## 1 answer

### Answer from Croct Bot (2026-11-14)

The export was renamed. What older tutorials call middleware is now the proxy:

```ts
export {proxy} from '@croct/plug-next/proxy';

export const config = {
    matcher: ['/((?!api|_next/static|_next/image|favicon.ico).*)'],
};
```

The matcher excludes paths like api, _next/static and similar so the proxy only
runs where it should. Since you already have auth middleware, do not add a second
middleware file. Compose them in your existing one with the `withCroct` wrapper so
both run in order. On the client side the App Router provider is
`@croct/plug-next/CroctProvider`, which is env-driven through
NEXT_PUBLIC_CROCT_APP_ID and CROCT_API_KEY and takes no appId prop, and server
content is read with fetchContent from `@croct/plug-next/server`.

See [the `proxy` export and matcher](https://docs.croct.com/reference/sdk/nextjs/api/functions/proxy)
and [composing with `withCroct`](https://docs.croct.com/reference/sdk/nextjs/api/functions/with-croct).
