cors

package
v0.7.5 Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package cors provides CORS (Cross-Origin Resource Sharing) middleware

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllowAll

AllowAll creates permissive CORS middleware (development only!)

func Handler

Handler creates CORS middleware with default config

func New

New creates CORS middleware with custom config

Types

type Config

type Config struct {
	AllowedOrigins     []string
	AllowedMethods     []string
	AllowedHeaders     []string
	ExposedHeaders     []string
	AllowCredentials   bool
	MaxAge             int // in seconds
	OptionsPassthrough bool
}

Config holds CORS configuration

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns sensible CORS defaults

Jump to

Keyboard shortcuts

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