cors

package
v2.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 2, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package cors provides contrib CORS middleware configuration.

Use explicit allowed origins, methods, and headers for browser-facing APIs. Avoid wildcard origins in production unless the route is intentionally public and credential-free.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultOptions

func DefaultOptions() ports.CORSOptions

DefaultOptions returns sensible default CORS options.

func New

func New() ports.CORSHandler

New creates a new CORS handler that implements ports.CORSHandler.

Types

type Handler

type Handler struct{}

Handler provides CORS functionality.

func (*Handler) Handler

func (h *Handler) Handler(opts ports.CORSOptions) func(http.Handler) http.Handler

Handler returns a CORS handler with the given options.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL