Skip to content

Commit a136b97

Browse files
authored
feat(durable-iterator): x-orpc-durable-iterator header (#1032)
<!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - New Features - Standardized the Durable Iterator response header to x-orpc-durable-iterator for clearer interoperability. - Documentation - Added CORS guidance and examples showing how to expose the x-orpc-durable-iterator header in server-side setup. - Refactor - Renamed the public Durable Iterator header; update any references to the previous header name. - Chores - Minor internal alignment to reflect the new header name across the integration. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent 01f0b7a commit a136b97

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

apps/content/docs/integrations/durable-iterator.md

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,22 @@ const handler = new RPCHandler(router, {
198198
})
199199
```
200200

201+
::: warning CORS Policy
202+
The `DurableIteratorHandlerPlugin` adds an `x-orpc-durable-iterator` header to responses, indicating that the response contains a durable iterator. For cross-origin requests, you must configure CORS to expose this header to clients.
203+
204+
```ts
205+
const handler = new RPCHandler(router, {
206+
plugins: [
207+
new CORSPlugin({
208+
exposeHeaders: ['x-orpc-durable-iterator'], // [!code highlight]
209+
}),
210+
new DurableIteratorHandlerPlugin(),
211+
],
212+
})
213+
```
214+
215+
:::
216+
201217
## Client Side
202218

203219
On the client side, simply configure the plugin. Usage is identical to [Event Iterator](/docs/client/event-iterator). The `url` in `DurableIteratorLinkPlugin` points to your Durable Object upgrade endpoint:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
export const DURABLE_ITERATOR_TOKEN_PARAM = 'token' as const
22
export const DURABLE_ITERATOR_ID_PARAM = 'id' as const
3-
export const DURABLE_ITERATOR_PLUGIN_HEADER_KEY = 'x-orpc-dei' as const
3+
export const DURABLE_ITERATOR_PLUGIN_HEADER_KEY = 'x-orpc-durable-iterator' as const
44
export const DURABLE_ITERATOR_PLUGIN_HEADER_VALUE = '1' as const

0 commit comments

Comments
 (0)