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.