Home / Function/ getCorsHeaders() — supabase Function Reference

getCorsHeaders() — supabase Function Reference

Architecture documentation for the getCorsHeaders() function in route.ts from the supabase codebase.

Entity Profile

Dependency Diagram

graph TD
  32c83917_970b_cf02_2abb_8389e879c684["getCorsHeaders()"]
  45f64da6_d949_22b4_f6f8_853a312ea9ea["getResponseHeaders()"]
  45f64da6_d949_22b4_f6f8_853a312ea9ea -->|calls| 32c83917_970b_cf02_2abb_8389e879c684
  9d7ff13f_efdf_f6b5_75c4_c0fbedc42b47["handleRequest()"]
  9d7ff13f_efdf_f6b5_75c4_c0fbedc42b47 -->|calls| 32c83917_970b_cf02_2abb_8389e879c684
  1f83602c_2cbe_c7f9_e812_33f23c91296b["OPTIONS()"]
  1f83602c_2cbe_c7f9_e812_33f23c91296b -->|calls| 32c83917_970b_cf02_2abb_8389e879c684
  84859638_9683_aecb_7417_473b553f8468["isAllowedCorsOrigin()"]
  32c83917_970b_cf02_2abb_8389e879c684 -->|calls| 84859638_9683_aecb_7417_473b553f8468
  style 32c83917_970b_cf02_2abb_8389e879c684 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

apps/docs/app/api/graphql/route.ts lines 60–72

function getCorsHeaders(request: Request): Record<string, string> {
  const origin = request.headers.get('Origin')

  if (origin && isAllowedCorsOrigin(origin)) {
    return {
      'Access-Control-Allow-Origin': origin,
      'Access-Control-Allow-Methods': 'GET, POST, OPTIONS',
      'Access-Control-Allow-Headers': 'Content-Type, Accept',
    }
  }

  return {}
}

Subdomains

Frequently Asked Questions

What does getCorsHeaders() do?
getCorsHeaders() is a function in the supabase codebase.
What does getCorsHeaders() call?
getCorsHeaders() calls 1 function(s): isAllowedCorsOrigin.
What calls getCorsHeaders()?
getCorsHeaders() is called by 3 function(s): OPTIONS, getResponseHeaders, handleRequest.

Analyze Your Own Codebase

Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.

Try Supermodel Free