Home / Type/ CorsOptions Type — vite Architecture

CorsOptions Type — vite Architecture

Architecture documentation for the CorsOptions type/interface in http.ts from the vite codebase.

Entity Profile

Dependency Diagram

graph TD
  c5436c2a_1387_d2c6_fadc_45f859583837["CorsOptions"]
  695bc011_d16d_4322_2fef_1a59a092ee32["http.ts"]
  c5436c2a_1387_d2c6_fadc_45f859583837 -->|defined in| 695bc011_d16d_4322_2fef_1a59a092ee32
  style c5436c2a_1387_d2c6_fadc_45f859583837 fill:#6366f1,stroke:#818cf8,color:#fff

Relationship Graph

Source Code

packages/vite/src/node/http.ts lines 95–115

export interface CorsOptions {
  /**
   * Configures the Access-Control-Allow-Origin CORS header.
   *
   * **We recommend setting a specific value rather than
   * `true`** to avoid exposing the source code to untrusted origins.
   */
  origin?:
    | CorsOrigin
    | ((
        origin: string | undefined,
        cb: (err: Error, origins: CorsOrigin) => void,
      ) => void)
  methods?: string | string[]
  allowedHeaders?: string | string[]
  exposedHeaders?: string | string[]
  credentials?: boolean
  maxAge?: number
  preflightContinue?: boolean
  optionsSuccessStatus?: number
}

Frequently Asked Questions

What is the CorsOptions type?
CorsOptions is a type/interface in the vite codebase, defined in packages/vite/src/node/http.ts.
Where is CorsOptions defined?
CorsOptions is defined in packages/vite/src/node/http.ts at line 95.

Analyze Your Own Codebase

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

Try Supermodel Free