Skip to content

Latest commit

 

History

History
29 lines (22 loc) · 601 Bytes

README.md

File metadata and controls

29 lines (22 loc) · 601 Bytes

Cross-Origin Resource Sharing for bunrouter

To run this example:

go run main.go

To test that CORS are allowed from localhost:

curl -H "Origin: http://localhost:9999" \
  -H "Access-Control-Request-Method: POST" \
  -X OPTIONS \
  --verbose \
  http://localhost:9999/api/v1/users/123

To test that CORS are restricted from other domains:

curl -H "Origin: https://uptrace.dev" \
  -H "Access-Control-Request-Method: POST" \
  -X OPTIONS \
  --verbose \
  http://localhost:9999/api/v1/users/123

See documentation for details.