Skip to main content
Guides/Tech Stack

API CORS Check: Understand and Use the Results

Analyze CORS configuration

EdgeDNS Team·Updated ·5 min read

CORS: the browser rule that decides which sites can talk to which APIs

CORS (Cross-Origin Resource Sharing) is the security rule that browsers enforce to control whether JavaScript on one website is allowed to make HTTP requests to a different website's API. By default, browsers refuse: it is called the same-origin policy, and it has been part of every web browser since the 1990s. CORS is the exception mechanism that lets a server explicitly say "yes, JavaScript on these specific other origins is allowed to call me." The mechanism is a small set of HTTP headers (`Access-Control-Allow-Origin`, `Access-Control-Allow-Methods`, `Access-Control-Allow-Credentials`, etc.) that the API server returns, and the browser enforces them on the client side.

You should care because CORS is one of the most-misunderstood and most-blamed parts of modern web development. Every developer who has ever built a single-page application has hit a CORS error and assumed it was a bug. It is not a bug; it is the browser working correctly to prevent a malicious site from making requests to your bank on your behalf. The error is the intended behavior. Understanding CORS — really understanding it — is the difference between debugging it in five minutes and debugging it in two hours. It is also a real security control: a misconfigured CORS policy can quietly expose an API to the entire internet in a way that defeats the entire same-origin protection.

The five things every CORS check looks at:

  • Is `Access-Control-Allow-Origin` set? If not, no cross-origin requests are allowed at all.

  • **Is it set to `*` (allow any origin), to a specific list, or dynamically reflected from the request?** The dynamic-reflection pattern is the dangerous one — if combined with `Access-Control-Allow-Credentials: true`, it effectively disables the same-origin policy.

  • Are the allowed methods (`Access-Control-Allow-Methods`) appropriate? Allowing `DELETE` and `PUT` cross-origin is almost always a sign of a misconfiguration.

  • Are credentials (cookies, auth headers) allowed cross-origin? `Access-Control-Allow-Credentials: true` is the riskiest setting and should only be combined with a specific origin allowlist, never `*`.

  • Is the preflight (`OPTIONS`) request handled correctly? Browsers send a preflight before any non-trivial cross-origin request; getting this wrong breaks legitimate use cases.

Three questions a CORS check answers:

  • Is this API's CORS policy reasonable, or does it expose the API to any website on the internet?

  • For a security review, is the policy correctly restricted to the origins that should actually have access?

  • For an integration project, will my front-end be allowed to call this API from the browser?

The cost of misconfigured CORS is either (a) a security vulnerability that lets any website call this API as the user, or (b) endless debugging from developers who can't figure out why their request is being blocked. The fix is to read the CORS headers, understand them, and configure them deliberately. The CORS specification is in the Fetch standard and the canonical reference is Mozilla's CORS guide on MDN.

What EdgeDNS specifically catches. Beyond the basic wildcard-with-credentials check, the probe surfaces the OWASP/PortSwigger-grade CORS findings that simple checks miss: (1) Missing `Vary: Origin` — when a server uses a dynamic origin allow-list or reflects the request Origin, browsers can cache responses meant for origin A and serve them to origin B (cross-origin cache poisoning). (2) Allow-list bypass — the probe registers attacker-style origins like `<domain>.attacker.com` and `attacker.com.<domain>` to detect prefix/suffix regex flaws. (3) GET fallback — many backends spec-violate by attaching CORS headers only on the actual request, not the preflight; if OPTIONS comes back empty, the probe retries with a simple GET so those deployments aren't silently reported as 'CORS disabled.'

The API CORS Check endpoint, in plain language

Analyze CORS configuration

Misconfigured CORS is a common security vulnerability (per OWASP Web Security Testing Guide) that can allow unauthorized cross-origin access. Testing CORS configuration helps identify potential data exposure risks.

What is actually happening when you call it

Sends three parallel OPTIONS preflights with different Origin headers (example.com, evil.attacker.com, null). If the preflights return no CORS headers, falls back to a GET probe — many backends spec-violate by only attaching CORS headers on real requests, not preflights. When origin reflection is detected, runs two additional probes (`<domain>.attacker.com` and `attacker.com.<domain>`) to catch prefix/suffix allow-list bypasses. Always checks for `Vary: Origin` when the server uses a non-wildcard origin — its absence is a CRITICAL finding per MDN and PortSwigger (browsers can cache responses meant for origin A and serve them to origin B).

Why this specific tool matters

Choose a task: Security Audit. Audit API (Application Programming Interface) CORS configuration for overly permissive settings.

Run the API CORS Check request below and retain the input and observed result. Before changing configuration, compare the relevant fields with the value or policy you expected. Use the API CORS Check reference to check the field definitions and supported options.

Info:

Available on the developer plan. The technical details: `GET /v1/domain/api-cors`.

When would I actually use this?

Security Audit

Audit API (Application Programming Interface) CORS configuration for overly permissive settings.

Use the finding: Find CORS misconfigurations before attackers exploit them.

API Development

Verify CORS is properly configured for expected client origins.

Use the finding: Ensure CORS settings match application requirements.

Penetration Testing

Test for CORS vulnerabilities during web application assessments.

Use the finding: Identify exploitable CORS configurations.

The easiest way: just ask your AI assistant

Connect the MCP server. Just ask in plain English:

Use domain_api_cors with domain=https://api.example.com. Show the returned findings, identify unavailable evidence, and explain a useful next check.

Confirm the tool and inputs in the client before accepting its summary. For API CORS Check, use the response fields below to separate observations from recommendations.

Tip:

The dedicated MCP server is available on every plan. Individual tool access and request limits depend on your plan. Management categories and endpoints disabled for the tool catalog are not exposed through MCP.

The technical way: call it from code

This API CORS Check request uses the example inputs from its API contract. Replace YOUR_API_KEY with a key on the developer plan or higher; adapt the target to your task.

bash
curl --request GET 'https://api.edgedns.dev/v1/domain/api-cors?domain=https%3A%2F%2Fapi.example.com' \
  --header "Authorization: Bearer YOUR_API_KEY"

Prepare inputs for API CORS Check

Start with the inputs below. Keep the same hostname, path, and options when comparing API CORS Check observations. The API reference contains the complete parameter contract, optional settings, and access requirements.

FieldTypeRequired?What it meansExample

domain

string

Yes

Domain or full URL (web address) — accepts `example.com` or `HTTPS://example.com/path`.

https://api.example.com

Interpret API CORS Check findings

Read these fields alongside the full response from your API CORS Check check. A missing value or failed lookup is different from a passing result. Keep returned errors and confidence or cache metadata when available; do not replace missing evidence with a successful default. See the complete response reference for additional fields.

FieldTypeWhat you'll see in it

domain

string

The queried domain (bare hostname).

url

string

Full URL (web address) that was fetched, echoing the protocol used in the request.

corsEnabled

boolean

Whether CORS headers are present

Words you might be wondering about

API (Application Programming Interface) — A way for one program to ask another program for something — like a waiter taking your order to the kitchen.

Need Programmatic Access?

Automate domain intelligence with 100+ API endpoints and a free MCP server for AI integration.

API CORS Check: Results Guide | EdgeDNS