Skip to content

Commit e808453

Browse files
Rename middleware -> proxy (#307)
1 parent eb61cd9 commit e808453

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

skills/flags-sdk/references/nextjs.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ export const exampleFlag = flag({
3434

3535
## App Router
3636

37-
Call the flag function from any async server component or middleware:
37+
Call the flag function from any async server component or proxy:
3838

3939
```tsx
4040
// app/page.tsx
@@ -95,7 +95,7 @@ export const myFlag = flag<boolean, Entities>({
9595
});
9696
```
9797

98-
`identify` receives normalized `headers` and `cookies` that work across App Router, Pages Router, and Middleware.
98+
`identify` receives normalized `headers` and `cookies` that work across App Router, Pages Router, and Proxy.
9999

100100
### Custom evaluation context
101101

@@ -126,7 +126,7 @@ Not available in Pages Router.
126126

127127
## Precompute
128128

129-
Keep pages static while using feature flags. Middleware evaluates flags and encodes results into the URL.
129+
Keep pages static while using feature flags. Proxy evaluates flags and encodes results into the URL.
130130

131131
### Prerequisites
132132

@@ -155,7 +155,7 @@ export const showBanner = flag({
155155
export const marketingFlags = [showSummerSale, showBanner] as const;
156156
```
157157

158-
### Step 2: Precompute in middleware
158+
### Step 2: Precompute in proxy
159159

160160
```ts
161161
// proxy.ts
@@ -320,7 +320,7 @@ export default async function DashboardPage() {
320320

321321
For static marketing pages with A/B tests, combine precompute with visitor ID generation:
322322

323-
### Visitor ID in middleware
323+
### Visitor ID in proxy
324324

325325
```ts
326326
// proxy.ts
@@ -329,7 +329,7 @@ import { type NextRequest, NextResponse } from 'next/server';
329329
import { marketingFlags } from './flags';
330330
import { getOrGenerateVisitorId } from './get-or-generate-visitor-id';
331331

332-
export async function marketingMiddleware(request: NextRequest) {
332+
export async function marketingProxy(request: NextRequest) {
333333
const visitorId = await getOrGenerateVisitorId(
334334
request.cookies,
335335
request.headers,
@@ -394,7 +394,7 @@ export const marketingAbTest = flag<boolean, Entities>({
394394

395395
## Proxy (Middleware)
396396

397-
Use flags in middleware to rewrite requests to static page variants:
397+
Use flags in proxy to rewrite requests to static page variants:
398398

399399
```ts
400400
// proxy.ts

0 commit comments

Comments
 (0)