cors

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(opts ...CORSOptions) egor.Middleware

New middleware. If the origin is not allowed, a 403 status code is sent.

Types

type CORSOptions

type CORSOptions struct {
	AllowedOrigins   []string // Origins that are allowed in the request, default is all origins
	AllowedMethods   []string // Methods that are allowed in the request
	AllowedHeaders   []string // Headers that are allowed in the request
	ExposedHeaders   []string // Headers that are exposed to the client
	AllowCredentials bool     // Allow credentials like cookies, authorization headers
	MaxAge           int      // Max age in seconds to cache preflight request
	Allowwebsockets  bool     // Allow websockets
}

CORSOptions is the configuration for the CORS middleware.

Jump to

Keyboard shortcuts

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