Documentation ¶
Overview ¶
Package cors sets the appropriate CORS(https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS) response headers, and lets you customize. Following customizations are allowed:
- provide a list of allowed domains
- provide a list of headers
- set the max-age of CORS headers
The list of allowed methods are
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddOptionsHandlers ¶
func AddOptionsHandlers(routes []*webgo.Route) []*webgo.Route
AddOptionsHandlers appends OPTIONS handler for all the routes The response body would be empty for all the new handlers added
func CORS ¶
func CORS(cfg *Config) webgo.Middleware
CORS is a single CORS middleware which can be applied to the whole app at once
func Middleware ¶
func Middleware(allowedOriginRegex []regexp.Regexp, corsTimeout, allowedMethods, allowedHeaders string) webgo.Middleware
Middleware can be used as well, it lets the user use this middleware without webgo
Types ¶
Click to show internal directories.
Click to hide internal directories.