cors

package
v0.2.10 Latest Latest
Warning

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

Go to latest
Published: Jun 30, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package cors implements a PreRequest CORS plugin that validates the request origin, applies CORS response headers, and short-circuits preflight requests.

Index

Constants

View Source
const PluginName = "cors"

PluginName is the catalog name used in policy configuration.

Variables

This section is empty.

Functions

This section is empty.

Types

type CorsData

type CorsData struct {
	Origin          string   `json:"origin"`
	Method          string   `json:"method"`
	Preflight       bool     `json:"preflight"`
	Allowed         bool     `json:"allowed"`
	RequestedMethod string   `json:"requested_method,omitempty"`
	AllowedMethods  []string `json:"allowed_methods,omitempty"`
}

CorsData is the per-invocation trace payload describing the CORS decision.

type Plugin

type Plugin struct{}

Plugin enforces a per-policy CORS policy.

func New

func New() *Plugin

New builds a CORS plugin.

func (*Plugin) Execute

func (*Plugin) MandatoryStages

func (p *Plugin) MandatoryStages() []policy.Stage

func (*Plugin) MutatesMetadata added in v0.2.3

func (p *Plugin) MutatesMetadata() bool

func (*Plugin) MutatesRequestBody added in v0.2.3

func (p *Plugin) MutatesRequestBody() bool

func (*Plugin) MutatesResponseBody added in v0.2.3

func (p *Plugin) MutatesResponseBody() bool

func (*Plugin) Name

func (p *Plugin) Name() string

func (*Plugin) SupportedModes

func (p *Plugin) SupportedModes() []policy.Mode

func (*Plugin) SupportedStages

func (p *Plugin) SupportedStages() []policy.Stage

func (*Plugin) ValidateConfig

func (p *Plugin) ValidateConfig(settings map[string]any) error

Jump to

Keyboard shortcuts

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