Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Middleware ¶
func Middleware(config *server.ServerConfig) echo.MiddlewareFunc
Middleware returns an echo middleware that handles CORS for all requests.
If AllowedOrigins is configured in the server runtime config, the request Origin header is matched against each pattern using wildcard glob syntax (e.g. "https://*.example.com"). On a match, Access-Control-Allow-Origin is set to the exact origin value from the request. On no match for an OPTIONS preflight, 403 is returned. For other methods the request proceeds without the header, leaving the browser to enforce the same-origin policy.
If AllowedOrigins is empty (not configured), Access-Control-Allow-Origin is set to "*", preserving the previous open behaviour.
Types ¶
This section is empty.