Documentation
¶
Overview ¶
Package cors provides handlers to enable CORS support.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Options ¶
type Options struct {
// If set, all origins are allowed.
AllowAllOrigins bool
// A list of allowed origins. Wild cards and FQDNs are supported.
AllowOrigins []string
// A func for determining if `origin` is allowed at request time
ShouldAllowOrigin func(origin string, req *http.Request) bool
// If set, allows to share auth credentials such as cookies.
AllowCredentials bool
// A list of allowed HTTP methods.
AllowMethods []string
// A list of allowed HTTP headers.
AllowHeaders []string
// A list of exposed HTTP headers.
ExposeHeaders []string
// Max age of the CORS headers.
MaxAge time.Duration
}
Represents Access Control options.
func (*Options) Handler ¶
func (o *Options) Handler(next http.Handler) http.HandlerFunc
Allows CORS for requests those match the provided options.
Click to show internal directories.
Click to hide internal directories.