Skip to content

Instantly share code, notes, and snippets.

@dbrugne
Created October 27, 2023 13:00
Show Gist options
  • Save dbrugne/f1fb69e2eef22332752ec76ccecc299f to your computer and use it in GitHub Desktop.
Save dbrugne/f1fb69e2eef22332752ec76ccecc299f to your computer and use it in GitHub Desktop.
How to test CORS headers with cURL
curl -H "Origin: http://localhost:8080" \
-H "Access-Control-Request-Method: POST" \
-H "Access-Control-Request-Headers: X-Requested-With" \
-X OPTIONS --verbose \
http://localhost:8080/my/api
# ...
# < Access-Control-Allow-Origin: *
# < Access-Control-Allow-Methods: POST
# < Access-Control-Allow-Headers: X-Requested-With
# ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment