# rs/cors

Go net/http configurable handler to handle CORS requests

Repository: https://github.com/rs/cors
Canonical: https://ross.abutalabs.com/products/rs-cors
Language: Go
License: MIT
License Family: permissive
Last push: 2026-06-04T06:13:47+00:00

## Health v2 (maintenance only)
Score: 70/100 (v2, computed 2026-09-02T17:46:02.011165+00:00)
- activity 85, release rhythm 35, longevity 100
- inputs: {"age_days": 4330, "days_push": 90, "days_rel": null, "gap_med": null, "n_releases_24m": 0}
- flags: no_releases
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2898, forks 234 (observed 2026-08-28T04:07:28.791048+00:00)

## What it is
rs/cors is a Go library providing a configurable net/http handler that implements the Cross Origin Resource Sharing (CORS) W3C specification. It works as middleware for net/http and popular Go routers such as Goji, Martini, Negroni, and Alice.

## Use cases
- add CORS headers to a Go HTTP server
- allow cross-origin requests from specific domains in Go
- handle CORS preflight OPTIONS requests
- enable CORS middleware for a Go router like Goji or Negroni
- prevent insecure wildcard origin with credentials configuration
- serve a JSON API consumed by browsers from other origins

## When to choose
- you need standards-compliant CORS handling in a Go net/http application
- you want fine-grained control over allowed origins, methods, and headers
- you need a lightweight middleware that integrates with many Go routers

## When to avoid
- your server is not written in Go
- you need CORS handled at the reverse proxy or API gateway level instead of application code
- you rely on the removed behavior of reflecting arbitrary origins with credentials enabled

## Facets
- artifact type: library
- maturity: stable
- function: middleware, http-server, security, routing
- domain: web-development, backend, apis, security
- platform: go, cross-platform
- tags: cors, net-http, http-middleware, cross-origin-resource-sharing, web-server

## Member repositories
- rs/cors (main) score 70

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:07:28.791048+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-30T07:35:13.181165+00:00, confidence not recorded.
  - readme: https://github.com/rs/cors (fetched 2026-08-28T04:07:28.791048+00:00, sha a65d188dea32)
- Data as of 2026-08-30T08:39:29.467469+00:00.
