traefik_plugin_cors

package module
v0.1.7 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2020 License: MIT Imports: 4 Imported by: 0

README

traefik-cors

A Traefik Cors plugin.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(ctx context.Context, next http.Handler, config *Config, name string) (http.Handler, error)

New created a new plugin.

Types

type Config

type Config struct {
	AllowedOrigins     []string `json:"allowedOrigins,omitempty"`
	AllowedMethods     []string `json:"allowedMethods,omitempty"`
	AllowedHeaders     []string `json:"allowedHeaders,omitempty"`
	ExposedHeaders     []string `json:"exposedHeaders,omitempty"`
	AllowCredentials   bool     `json:"allowCredentials,omitempty"`
	OptionsPassthrough bool     `json:"optionsPassthrough,omitempty"`
	MaxAge             int      `json:"maxAge,omitempty"`
	Debug              bool     `json:"debug,omitempty"`
}

Config the plugin configuration.

func CreateConfig

func CreateConfig() *Config

CreateConfig creates the default plugin configuration.

type CorsTraefik added in v0.1.1

type CorsTraefik struct {
	Cors *cors.Cors
	// contains filtered or unexported fields
}

CorsTraefik a plugin.

func (*CorsTraefik) ServeHTTP added in v0.1.1

func (e *CorsTraefik) ServeHTTP(rw http.ResponseWriter, req *http.Request)

Directories

Path Synopsis
Package cors is net/http handler to handle CORS related requests as defined by http://www.w3.org/TR/cors/ You can configure it by passing an option struct to cors.New: c := cors.New(cors.Options{ AllowedOrigins: []string{"foo.com"}, AllowedMethods: []string{http.MethodGet, http.MethodPost, http.MethodDelete}, AllowCredentials: true, }) Then insert the handler in the chain: handler = c.Handler(handler) See Options documentation for more options.
Package cors is net/http handler to handle CORS related requests as defined by http://www.w3.org/TR/cors/ You can configure it by passing an option struct to cors.New: c := cors.New(cors.Options{ AllowedOrigins: []string{"foo.com"}, AllowedMethods: []string{http.MethodGet, http.MethodPost, http.MethodDelete}, AllowCredentials: true, }) Then insert the handler in the chain: handler = c.Handler(handler) See Options documentation for more options.

Jump to

Keyboard shortcuts

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