It sounds like you are asking if there's a way to prevent curl from making a request at all. This is impossible. curl can always make a request to the server, with or without CORS.
However, curl can also be used to mimic a browser and verify how your server will react to CORS requests. By using the --verbose
flag on curl requests, you can see the HTTP request and response headers, and verify that the CORS headers are working as expected. That is what this question covers: How can you debug a CORS request with cURL?
If CORS is enabled, you should see an Access-Control-Allow-Origin
header in the response. If CORS is disabled, you should not see any Access-Control-*
headers in the response.