Documentation ¶
Overview ¶
Package cors provides a handler for handling CORS.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var AllowAll = Options{
AllowOrigins: "*",
AllowHeaders: "*",
AllowMethods: "*",
}
AllowAll is the option that allows all origins, headers, and methods.
Functions ¶
Types ¶
type Options ¶
type Options struct { // the allowed origins (separated by commas). Use an asterisk (*) to indicate allowing all origins, "null" to indicate disallowing any. AllowOrigins string // whether the response to request can be exposed when the omit credentials flag is unset, or whether the actual request can include user credentials. AllowCredentials bool // the HTTP methods (separated by commas) that can be used during the actual request. Use an asterisk (*) to indicate allowing any method. AllowMethods string // the HTTP headers (separated by commas) that can be used during the actual request. Use an asterisk (*) to indicate allowing any header. AllowHeaders string // the HTTP headers (separated by commas) that are safe to expose to the API of a CORS API specification ExposeHeaders string // Max amount of seconds that the results of a preflight request can be cached in a preflight result cache. MaxAge time.Duration // contains filtered or unexported fields }
Options specifies how the CORS handler should respond with appropriate CORS headers.
Click to show internal directories.
Click to hide internal directories.