ZuploZuplo
LoginSign Up
  • Documentation
  • API Reference
Introduction
Getting Started
    Develop using the Portal
      1 - Setup Your Gateway2 - Rate Limiting3 - API Key Auth4 - Deploy5 - Dynamic Rate LimitingMCP - Quick start
    Develop Locally
      1 - Setup Your Gateway2 - Rate Limiting3 - API Key Auth
Concepts
Development
Policies
Handlers
API Keys
MCP Server
MCP Gateway
AI Gateway
Developer Portal
Monetization
Deploying & Source Control
Observability
Networking & Infrastructure
Account Management
Programming API
    Overview
    Request & Context
    Configuration
    Caching APIs
    Data Management
    Extensions & Hooks
    Error Handling
    Logging & Observability
    Types and Interfaces
      RequestUserCORS Policy Configuration
    Web Standards
    Advanced Topics
Build with AI
Zuplo CLI
Migration Guides
Platform LimitsSecuritySupportTrust & ComplianceChangelog
powered by Zudoku
Types and Interfaces

CORS Policy Configuration

For a complete guide on configuring CORS including built-in policies, wildcard origin matching, environment variables, and troubleshooting, see the Configuring CORS article.

CorsPolicyConfiguration

Custom CORS policies are defined in the corsPolicies array in the policies.json file. Each policy has the following properties:

PropertyTypeRequiredDescription
namestringYesA unique name used to reference this policy on routes.
allowedOriginsstring[] or stringYesOrigins permitted to make cross-origin requests. Supports wildcards (see Origin Matching).
allowedMethodsstring[] or stringNoHTTP methods allowed for cross-origin requests (e.g., GET, POST).
allowedHeadersstring[] or stringNoRequest headers the client can send. Use * to allow any header.
exposeHeadersstring[] or stringNoResponse headers the browser can access from JavaScript.
maxAgenumberNoTime in seconds the browser caches preflight results.
allowCredentialsbooleanNoWhether to include credentials (cookies, authorization headers) in cross-origin requests.

Built-in Policies

Every route has a corsPolicy property in x-zuplo-route that can be set to one of the built-in values or the name of a custom policy:

  • none - Disables CORS. All CORS headers are stripped from responses. This is the default.
  • anything-goes - Allows any origin, method, and header. Not recommended for production.

Example

config/policies.json
{ "corsPolicies": [ { "name": "my-cors-policy", "allowedOrigins": [ "https://app.example.com", "https://admin.example.com" ], "allowedMethods": ["GET", "POST", "PUT", "DELETE"], "allowedHeaders": ["Authorization", "Content-Type"], "exposeHeaders": ["X-Request-Id"], "maxAge": 3600, "allowCredentials": true } ] }
config/routes.oas.json
"x-zuplo-route": { "corsPolicy": "my-cors-policy", "handler": { "export": "urlForwardHandler", "module": "$import(@zuplo/runtime)" } }
Edit this page
Last modified on March 24, 2026
RequestUserWeb Standard APIs
On this page
  • CorsPolicyConfiguration
  • Built-in Policies
  • Example
JSON
JSON