# rs/cors

> Configurable CORS handler for Go's net/http

Source: https://talira.ai/catalog/rs-cors-tynk4dkh
Every listing: https://talira.ai/catalog.md

- Kind: Open source
- Types: Library
- Categories: [libraries / http middleware / cors](https://talira.ai/categories/libraries/http-middleware/cors), [languages / go](https://talira.ai/categories/languages/go)
- Licence: MIT[^2]
- Pricing: Free and open source[^1]
- Free tier: yes[^1]
- Backed by: [Olivier Poitrey](https://talira.ai/orgs/olivier-poitrey.md)

rs/cors is a Go `net/http` handler that implements the W3C Cross-Origin Resource Sharing specification. It sets the Access-Control headers for allowed origins, methods and headers, answers preflight requests, and takes options for origin wildcards, a custom origin check, credentials, exposed headers, max age and debug logging. Its README has examples for net/http, Gin, Chi, Gorilla, Negroni, Alice, HttpRouter, Goji, Martini and Buffalo.

## Links

- GitHub: https://github.com/rs/cors
- Docs: https://pkg.go.dev/github.com/rs/cors

## Problems it solves

- add CORS headers to my Go HTTP server
- allow cross-origin requests from my frontend to a Go API
- handle CORS preflight OPTIONS requests in Go

## Features

- net/http handler for CORS
- allowed origins with wildcards or a custom check function
- preflight handling with allowed methods and headers
- credentials, exposed headers and max age options
- examples for Gin, Chi, Gorilla and other Go routers

## Limitations

- It no longer reflects the request's Origin when AllowedOrigins is * with AllowCredentials true; restoring that needs an AllowOriginFunc that returns true, which its README warns about.[^1]

## Trust

Overall: 0.51 out of 1.
Signals: maintenance 0.62, adoption 0.69, momentum 0.40, community 0.67, backing 0.30, extensibility 0.00.

- last commit 10 days ago
- 3 commits in the last 90 days
- 2.9k GitHub stars
- 46 contributors
- backed by Olivier Poitrey

## Sources

[^1]: https://github.com/rs/cors/blob/master/README.md (checked 28 Nov 2026)
[^2]: https://github.com/rs/cors/blob/master/LICENSE (checked 28 Nov 2026)
