Skip to content

@adrianhall/cloudflare-toolkit


@adrianhall/cloudflare-toolkit / lib/vite / cloudflareAccessPlugin

Function: cloudflareAccessPlugin()

cloudflareAccessPlugin(options?): Plugin

Defined in: src/lib/vite/plugin.ts:132

Create the dev-only Cloudflare Access emulation plugin.

Register it before @cloudflare/vite-plugin (and any framework plugin) so its connect middleware runs first:

ts
plugins: [cloudflareAccessPlugin(), cloudflare(), react()]

The middleware is registered synchronously in the configureServer hook body (combined with enforce: "pre") so that it sits ahead of the request → workerd dispatch handler that @cloudflare/vite-plugin registers from its post hook.

Parameters

options?

CloudflareAccessPluginOptions = {}

Configuration for path policies, the dev secret, selectable login identities, the login form path, and the dev token lifetime.

Returns

Plugin

A Vite Plugin.