For AI agents: the documentation index is at llms.txt. Guide pages have a markdown version at the same path with .md appended, before any query string or fragment.

JavaScript: corsHeaders

Default CORS headers for Supabase Edge Functions.

Includes all headers sent by Supabase client libraries and allows all standard HTTP methods. Use this for simple CORS configurations with wildcard origin.

Examples

Basic usage

import { corsHeaders } from '@supabase/supabase-js/cors'

Deno.serve(async (req) => {
  if (req.method === 'OPTIONS') {
    return new Response('ok', { headers: corsHeaders })
  }

  return new Response(
    JSON.stringify({ data: 'Hello' }),
    { headers: { ...corsHeaders, 'Content-Type': 'application/json' } }
  )
})