Go CORS handler is a Go package that provides a configurable middleware handler for Cross-Origin Resource Sharing in net/http applications. It is designed to make CORS behavior explicit, predictable, and easy to insert into an existing HTTP handler chain. Developers can define which origins, methods, headers, and credentials are allowed, instead of scattering CORS logic across routes. The library also handles preflight requests, making it useful for APIs consumed by browsers, frontend apps, and third-party clients. Because it returns a standard net/http handler, it fits naturally into many Go web stacks and routers. It is a focused utility for teams that need reliable CORS handling without adopting a larger framework.
Features
- Configurable allowed origins
- Allowed methods and headers
- Credential support controls
- Preflight request handling
- Standard net/http middleware
- Small Go library footprint