Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
Middleware is the CORS middleware function that takes a Config struct and returns the middleware.
func ValidateOriginFromList ¶
ValidateOriginFromList returns a function that validates an origin against the provided list of allowed origins.
Types ¶
type Config ¶
type Config struct {
AllowCredentials bool // Flag to allow sending of credentials (cookies, etc.).
AllowedMethods []string // List of allowed HTTP methods.
AllowedHeaders []string // List of allowed HTTP request headers.
ExposedHeaders []string // List of exposed response headers.
MaxAge int // Maximum age (in seconds) of the CORS preflight cache.
ValidateHeader func(string) bool // Custom function to validate the request headers.
ValidateOrigin func(string) bool // Custom function to validate the origin.
}
Config is a struct that holds configuration options for the CORS middleware.
Click to show internal directories.
Click to hide internal directories.