Mock an API with CORS

Create a public mock that browser JavaScript can call from any origin — no CORS errors, no proxy.

When to use this

When your frontend runs on localhost and the API is a mock on another origin, the browser blocks the fetch with a CORS error. Turn on CORS and Quickmock answers the preflight and adds permissive Access-Control-* headers, so fetch() just works from any origin while you build the UI. No credentials are exposed — the preset is wildcard-origin without Allow-Credentials.

Create the mock

curl -X POST https://quickmock.dev/api/mocks \
  -H 'Content-Type: application/json' \
  -d '{
  "method": "GET",
  "content_type": "application/json",
  "response_body": "{\"ok\":true}",
  "cors_enabled": true
}'

Call it

curl -H 'Origin: https://app.example.com' https://quickmock.dev/m/<slug>

What you get

the response carries Access-Control-Allow-Origin: *
and OPTIONS preflight answers 204 — fetch() works from any origin

Build your own

Create a mock

← All guides