Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(opts ...CORSOptions) rex.Middleware
New creates a Cors middleware with default options. If opts argument is provided, it is used instead of defaults. All CORSOptions must be provided since there is no merging with defaults. 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.
Click to show internal directories.
Click to hide internal directories.