caddy_cors

package module
v0.0.0-...-642e22d Latest Latest
Warning

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

Go to latest
Published: Apr 5, 2023 License: MIT Imports: 12 Imported by: 0

README

Caddy CORS

A Caddy v2 module to handle CORS.

Documentation

Index

Constants

View Source
const (

	// Defaults
	DefaultMaxAge = 600

	// DefaultHTTPMethods is the default list of HTTP methods that are allowed.
	// Array of strings GET, POST, OPTIONS
	DefaultHTTPMethods = "GET, POST, OPTIONS"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CORS

type CORS struct {
	Path             string   `json:"path,omitempty"`
	Origins          []string `json:"origins,omitempty"`
	Origin           string   `json:"origin,omitempty"`
	OriginRegexps    []string `json:"origin_regexps,omitempty"`
	HTTPMethods      string   `json:"http_methods,omitempty"`
	AllowCredentials *bool    `json:"allow_credentials,omitempty"`
	MaxAge           *int     `json:"max_age,omitempty"`
	// contains filtered or unexported fields
}

func (CORS) CaddyModule

func (CORS) CaddyModule() caddy.ModuleInfo

CaddyModule returns the Caddy module information.

func (*CORS) Provision

func (c *CORS) Provision(ctx caddy.Context) error

func (CORS) ServeHTTP

func (c CORS) ServeHTTP(w http.ResponseWriter, r *http.Request, next caddyhttp.Handler) error

func (*CORS) UnmarshalCaddyfile

func (c *CORS) UnmarshalCaddyfile(d *caddyfile.Dispenser) error

UnmarshalCaddyfile implements caddyfile.Unmarshaler.

func (*CORS) Validate

func (c *CORS) Validate() error

Jump to

Keyboard shortcuts

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