Documentation ¶
Overview ¶
Package cors provides functionality for adding CORS response headers into a handler chain.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateOptionsHandler ¶
func CreateOptionsHandler(allowed AllowList, methods ...string) http.HandlerFunc
CreateOptionsHandler creates a generic options handler that takes a list of allowed methods. allowListRE matches hostnames against the given regexp, and provides CORS headers where allowed.
Types ¶
type AllowList ¶
AllowList allows the user to craft a custom hostname matcher. An AllowList returns true if the requested origin should include valid CORS headers based on an incoming hostname.
func HostByAllowList ¶
HostByAllowList matches the hostname to a given map of allowed hosts.
Click to show internal directories.
Click to hide internal directories.