LakeQL
  • Overview
Server Setup
  • Create Server
  • Define Config
  • Yoga Configuration
  • createLakeQLApp
Authentication
  • Authorization Model
  • JWT Authentication
  • Permissions
  • Scope Authorization
  • Trino User Impersonation
  • Debugging Identity
Schema Builder
  • Builder Configuration
  • Scalar Types
  • Comparison Types
  • Pagination
  • Input Validation
Customization
  • Custom Queries & Mutations
  • Extending Core
  • CORS Configuration
  • Error Handling
  • API Reference
GitHub
LakeQL
  1. API
  2. Customization
  3. CORS Configuration

On this page

  1. Default

CORS Configuration

Control cross-origin access to the GraphQL endpoint.

The cors option on defineApiConfig controls CORS for the GraphQL route. The Hono layer that wraps the GraphQL server applies it.

1
2
3
4
5
6
7
8
9
const server = defineApiConfig({
  runtime,
  tokenResolver,
  cors: {
    origin: "https://app.example.com",
    credentials: true,
  },
})

The option shape is Hono's CORS middleware config, with origin, allowMethods, allowHeaders, credentials, and so on.

Default #

When cors is omitted, CORS is not enabled. The GraphQL route is same-origin only, and no Access-Control-Allow-Origin header is sent. Set origin to opt in.

A wildcard origin ("*") cannot be combined with credentials: true. Browsers reject that pairing, so there is no permissive-with-credentials default. List the exact front-end origins that should reach the API.

Previous page

Extending Core

Next page

Error Handling