Skip to content

feat(http): add CORSConfig for the cross-origin policy of an API - #366

Merged
patdowney merged 1 commit into
masterfrom
feat/cors-config
Nov 15, 2026
Merged

patdowney merged 1 commit into
masterfrom
feat/cors-config

Conversation

@patdowney

Copy link
Copy Markdown
Contributor

Summary

  • Add http.CORSConfig (allowed origins, allow-localhost, methods, headers, exposed headers, credentials, private network, max age) with Options(logger, debug) and Middleware(logger, debug).
  • An empty config is closed: unlike rs/cors, which allows every origin when given none. * is explicit, and localhost is an AllowLocalhost opt-in.
  • Defaults: Content-Type and Authorization headers, 24h max age. Methods are left to rs/cors. Credentials and private network are opt-in.

connect-control, connect and eventbroker each carry their own copy of this policy; this lets them share it (dioad/connect#559).

Test plan

  • go test -race ./http/
  • make lint shows no new findings (http/operations.go QF1002 is already on master)

🤖 Generated with Claude Code

https://claude.ai/code/session_01SS4MAwAn85D1gkEzLtjYaZ

CORSConfig turns the origins, headers and flags services take in their
configuration into rs/cors options and a middleware. Unlike rs/cors an empty
config allows nothing, and localhost is an explicit AllowLocalhost opt-in.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SS4MAwAn85D1gkEzLtjYaZ
@patdowney
patdowney merged commit c0083c3 into master Nov 15, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant