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.
Supported by
Section titled “Supported by”http
mode
Default Behavior
Section titled “Default Behavior”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.
Custom setup
Section titled “Custom setup”Allow only domains mentioned in the chimera.cors
chimera-cli --path data.json http --cors
Directoryproject/
- data.json
- chimera.cors
Example chimera.cors
Section titled “Example chimera.cors”http://localhost:3000https://example.comhttps://api.example.comhttps://*.example.orghttp://127.0.0.1:8080
Preflight Requests
Section titled “Preflight Requests”Chimera automatically handles OPTIONS preflight requests by responding with the appropriate headers and a 204 No Content
response.