To test CORS using curl, you can simulate both preflight (OPTIONS) and actual GET/POST requests by setting custom headers.
✅ 1. Test Preflight (OPTIONS) Request
This simulates a browser preflight request:✅ You should see response headers like:
✅ 2. Test Actual GET Request with CORS
This simulates a CORS request from a browser-based client:200 (or similar) with:
✅ 3. Test CORS Denial Case (For Comparison)
To validate that CORS is working as expected (not always open), try from an origin that should be blocked (if you configured a specific origin):Access-Control-Allow-Origin in the response if the origin is restricted.
