Skip to content

CORS Support

Chimera supports Cross-Origin Resource Sharing (CORS) out of the box. This allows your frontend applications to make requests to the Chimera mock server running on a different origin during development.

  • http mode

By default, Chimera enables permissive CORS headers for all incoming requests. This includes:

  • Access-Control-Allow-Origin: *
  • Access-Control-Allow-Methods: GET, POST, PUT, PATCH, DELETE, OPTIONS
  • Access-Control-Allow-Headers: *

This setup ensures that your browser-based applications can freely communicate with the mock API without CORS errors.

Allow only domains mentioned in the chimera.cors

Terminal window
chimera-cli --path data.json http --cors
  • Directoryproject/
    • data.json
    • chimera.cors
http://localhost:3000
https://example.com
https://api.example.com
https://*.example.org
http://127.0.0.1:8080

Chimera automatically handles OPTIONS preflight requests by responding with the appropriate headers and a 204 No Content response.