Skip to main content

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:
You should see a successful HTTP 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):
You should not see Access-Control-Allow-Origin in the response if the origin is restricted.

🧪 Optional: Verbose Debugging

This shows SSL negotiation, redirects, and response headers line by line.