Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Handler ¶
type Handler func(http.ResponseWriter, *http.Request)
func AllowAll ¶
func AllowAll() Handler
Creates a CORS Handler that allows all origins by setting "Access-Control-Allow-Origin" header to the requester's 'Origin' value. This means any domain can access resources on your server. Use of this function in production is discouraged.
func GetGlobalPolicy ¶
func GetGlobalPolicy() Handler
Retrieves the currently set global CORS policy handler.
func PublicDomain ¶
func PublicDomain() Handler
Creates a CORS handler that allows unrestricted cross-origin access to public APIs. Designed for completely open endpoints WITHOUT authentication/authorization requirements. Example usage:
- Public weather data APIs - Non-sensitive product catalogs - Static asset delivery
func SameOrigin ¶
Creates a CORS Handler that allows requests from origins whose domain is a suffix match for any of the provided domains. Examples:
- SameOrigin("domain1.com") allows http://app.domain1.com, https://api.sub.domain1.com - SameOrigin("sub.domain1.com") allows http://app.sub.domain1.com, https://sub.domain1.com