Test CORS against a real second origin
Sometimes one example isn't enough.
Compare a failing browser request with a known-good control. Use the test endpoints to explore CORS headers, credentials, redirects, and preflight requests.
Choose a tool
Debug a real CORS problem
Compare your failing request with a known-good control from your app’s origin.
Explore CORS scenarios
Try a preset or your own API URL from the Playground’s origin.
Explain a browser error
Paste a Console message and get a local explanation of what it likely means.
Try the endpoints
Run a real cross-origin request from anotherexample.com to cors.anotherexample.com and inspect what your browser allows this page to read.
Endpoints
API reference and copyable examples
Both hosts serve the same endpoints. The examples use https://cors.anotherexample.com, which is a different origin from https://anotherexample.com. If your page is already on the cors. host, use https://anotherexample.com as the other origin.
For a cross-origin browser request that needs CORS response headers, start with an /api/cors/ endpoint.
ANY /api/cors/open
Permissive CORS with Access-Control-Allow-Origin: * for non-credentialed testing. The wildcard does not enable credentialed requests or expose non-safelisted response headers by itself.
https://cors.anotherexample.com/api/cors/open
ANY /api/echo
Returns method, safe request headers, query parameters, body, and timestamp. Sensitive headers and client IP information are omitted. Use curl or a browser page on the same origin.
https://cors.anotherexample.com/api/echo
ANY /api/cors/credentials
Reflects the request Origin and sends Access-Control-Allow-Credentials: true for credentialed CORS testing. This is a test endpoint; production APIs should allowlist trusted origins rather than reflect arbitrary origins.
https://cors.anotherexample.com/api/cors/credentials
ANY /api/cors/lab
Configure the allowed origin, methods, headers, and preflight response. This example omits the allow-origin header.
https://cors.anotherexample.com/api/cors/lab?allowOrigin=none
ANY /api/status/:code
Return an intentional HTTP status from 200–599.
https://cors.anotherexample.com/api/status/418
ANY /api/delay/:ms
Delay a response by up to 10,000 milliseconds.
https://cors.anotherexample.com/api/delay/1000
GET /api/redirect
Test 301/302/303/307/308 redirects to safe predefined targets. Redirected preflights fail; simple cross-origin redirects are evaluated against the redirect target.
https://cors.anotherexample.com/api/redirect?target=health&status=302
GET /api/cookie/set
Set a test cookie with Lax, Strict, or None SameSite behavior.
https://cors.anotherexample.com/api/cookie/set?sameSite=Lax
GET /api/cookie/check
See whether the browser sent a Cookie header back.
https://cors.anotherexample.com/api/cookie/check
GET /api/cookie/clear
Remove the test cookie from this host.
https://cors.anotherexample.com/api/cookie/clear
GET /api/health
Simple service health check.
https://cors.anotherexample.com/api/health
CORS request types
Browsers can send some cross-origin requests directly, such as GET/HEAD and some POST requests that use only CORS-safelisted headers and content types. Other requests—such as PUT/DELETE, application/json posts, or requests with Authorization or custom headers—normally trigger an OPTIONS preflight first.
Quick examples
fetch('https://cors.anotherexample.com/api/cors/open')
.then(r => r.json())
.then(console.log);
curl https://anotherexample.com/api/status/418
curl https://anotherexample.com/api/delay/1000
curl -i 'https://anotherexample.com/api/redirect?target=example&status=302'
Cookie testing
/api/cookie/set?sameSite=Lax /api/cookie/set?sameSite=Strict /api/cookie/set?sameSite=None /api/cookie/check /api/cookie/clear