Skip to content

Commit 2f203a1

Browse files
committed
Document Next.js proxy matcher exclusion instructions
1 parent aa44eb5 commit 2f203a1

2 files changed

Lines changed: 35 additions & 6 deletions

File tree

docs/content/docs/getting-started/next.mdx

Lines changed: 34 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,40 @@ Workflows can be triggered from API routes, Server Actions, or any server-side c
201201

202202
<Step>
203203

204-
## Run in Development
204+
## Configure Proxy Handler (if applicable)
205+
206+
If your Next.js app has a [proxy handler](https://nextjs.org/docs/app/api-reference/file-conventions/proxy)
207+
(formerly known as "middleware"), you'll need to update the matcher pattern to exclude Workflow's
208+
internal paths to prevent the proxy handler from running on them.
209+
210+
Add `.well-known/workflow/*` to your middleware's exclusion list:
211+
212+
```typescript title="proxy.ts" lineNumbers
213+
import { NextResponse } from 'next/server';
214+
import type { NextRequest } from 'next/server';
215+
216+
export function proxy(request: NextRequest) {
217+
// Your middleware logic
218+
return NextResponse.next();
219+
}
220+
221+
export const config = {
222+
matcher: [
223+
// ... your existing matchers
224+
{
225+
source: '/((?!_next/static|_next/image|favicon.ico|.well-known/workflow/.*)', // [!code highlight]
226+
},
227+
],
228+
};
229+
```
230+
231+
This ensures that internal Workflow paths are not intercepted by your middleware, which could interfere with workflow execution and resumption.
232+
233+
</Step>
234+
235+
</Steps>
236+
237+
## Run in development
205238

206239
To start your development server, run the following command in your terminal in the Next.js root directory:
207240

@@ -224,10 +257,6 @@ npx workflow inspect runs
224257
# or add '--web' for an interactive Web based UI
225258
```
226259

227-
</Step>
228-
229-
</Steps>
230-
231260
---
232261

233262
## Deploying to production

docs/content/docs/getting-started/nitro.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ This Route Handler creates a `POST` request endpoint at `/api/signup` that will
196196

197197
<Step>
198198

199-
## Run in Development
199+
## Run in development
200200

201201
To start your development server, run the following command in your terminal in the Nitro root directory:
202202

0 commit comments

Comments
 (0)