Deploy Preview
deploy_previewDeploy a preview of an existing Worker without touching production, returning a stable per-preview URL. Re-deploying the same preview name updates it in place.
Instructions
Deploy a preview of an existing Worker without touching production: either a static-site directory (assets) or Worker code (modules). Returns a stable per-preview URL (https://-..workers.dev) and a per-deployment URL. Re-deploying the same preview_name updates that preview. Uses the beta Worker Previews API.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| modules | No | Worker code: modules, each with inline content or a local file path; the first is the entry point unless main_module says otherwise | |
| bindings | No | Bindings for the preview (modules mode) | |
| directory | No | Static site: path to the built site directory (same handling as deploy_static_site) | |
| main_module | No | Entry-point module name (default: first module) | |
| script_name | Yes | The existing Worker to preview (deploy production first) | |
| preview_name | Yes | Preview name, e.g. a branch name. An existing preview with this name is reused, so its stable URL stays the same across deploys. | |
| html_handling | No | How HTML URLs are canonicalized (default: auto-trailing-slash) | |
| compatibility_date | No | YYYY-MM-DD; defaults to the Worker's current compatibility date | |
| not_found_handling | No | Response when no asset matches: 'single-page-application' serves /index.html (SPA mode), '404-page' serves /404.html (default: none) | |
| compatibility_flags | No | Runtime compatibility flags | |
| enable_preview_urls | No | Turn on the Worker's preview URLs (subdomain previews_enabled) if they are off. Without it previews deploy but aren't routable. Default true. Production workers.dev serving is never changed. |