Documentation
¶
Overview ¶
Package cors lets other origins call a Tern app's endpoints:
ternApp(kit.WithPlugins(cors.New(
cors.Origins("https://app.example.com"),
cors.Paths("/api/"),
)))
It answers preflight requests, adds the CORS headers to responses, and trusts the listed origins for Tern's cross-site request protection.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Option ¶
type Option func(*Plugin)
Option configures the plugin.
func Credentials ¶
func Credentials() Option
Credentials allows cookies and HTTP authentication on cross-origin requests.
func Headers ¶
Headers sets the request headers clients may send. The default is Content-Type and Authorization.
func Methods ¶
Methods sets the allowed methods. The default is GET, HEAD, POST, PUT, PATCH and DELETE.
func Origins ¶
Origins lists the origins allowed to make requests, such as "https://app.example.com". "*" allows any origin, but not with credentials.