# unrolled/secure

HTTP middleware for Go that facilitates some quick security wins.

Repository: https://github.com/unrolled/secure
Canonical: https://ross.abutalabs.com/products/secure
Language: Go
License: MIT
License Family: permissive
Topics: golang, go, middleware, security
Last push: 2026-05-01T20:53:04+00:00

## Health v2 (maintenance only)
Score: 70/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 80, release rhythm 40, longevity 100
- inputs: {"age_days": 4488, "days_push": 124, "days_rel": 680, "gap_med": 25, "n_releases_24m": 2}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 2354, forks 145 (observed 2026-08-28T04:06:40.516525+00:00)

## What it is
Secure is an HTTP middleware library for Go that adds quick security wins to web applications. It works as a standard net/http Handler and integrates with many Go frameworks, providing allowed-host filtering, SSL redirects, and security headers like HSTS, CSP, and X-Frame-Options.

## Use cases
- add security headers to a Go web server
- redirect HTTP requests to HTTPS in Go
- restrict which hostnames can reach my Go app
- set Content-Security-Policy and HSTS headers in Go
- protect a Go API against clickjacking and MIME sniffing
- enforce SSL behind a reverse proxy in Go

## When to choose
- you're building a Go web service with net/http or a compatible framework and want standard security headers
- you need host allowlisting and SSL redirect logic in middleware
- you want a small, focused, MIT-licensed library with no heavy dependencies

## When to avoid
- you need a full web application firewall or advanced threat protection
- your stack isn't Go
- you want automatic vulnerability scanning or dependency auditing rather than header hardening

## Facets
- artifact type: library
- maturity: stable
- function: middleware, security, http-server
- domain: security, web-development, backend
- platform: go
- tags: http-middleware, security-headers, ssl-redirect, csp, hsts, net-http, web-server

## Member repositories
- unrolled/secure (main) score 70

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:06:40.516525+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-30T02:36:29.138369+00:00, confidence not recorded.
  - readme: https://github.com/unrolled/secure (fetched 2026-08-28T04:06:40.516525+00:00, sha 282298da8885)
- Data as of 2026-08-30T08:39:29.467469+00:00.
