Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(cfg Config) atreugo.Middleware
New returns the middleware with the configured properties
IMPORTANT: always use as last middleware (`server.UseAfter(...)`).
Types ¶
type Config ¶
type Config struct {
// Specifies either the origins, which tells browsers to allow that origin
// to access the resource; or else — for requests without credentials —
// the "*" wildcard, to tell browsers to allow any origin to access the resource.
AllowedOrigins []string
// Specifies the method or methods allowed when accessing the resource.
// This is used in response to a preflight request.
// The conditions under which a request is preflighted are discussed above.
AllowedMethods []string
// This is used in response to a preflight request to indicate which HTTP headers
// can be used when making the actual request.
AllowedHeaders []string
// Indicates whether or not the response to the request can be exposed when
// the credentials flag is true. When used as part of a response to a preflight request,
// this indicates whether or not the actual request can be made using credentials.
// Note that simple GET requests are not preflighted, and so if a request is made
// for a resource with credentials, if this header is not returned with the resource,
// the response is ignored by the browser and not returned to web content.
AllowCredentials bool
// Indicates how long, in seconds, the results of a preflight request can be cached
AllowMaxAge int
// Header or headers to lets a server whitelist headers that browsers are allowed to access.
ExposedHeaders []string
}
Config configuration.
Click to show internal directories.
Click to hide internal directories.