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.
Click to show internal directories.
Click to hide internal directories.