cors

package
v0.83.15 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 3, 2026 License: MIT Imports: 4 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL