cors

package
v4.21.0 Latest Latest
Warning

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

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AllowedDomainsRegexPrefix = "re:"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CrossOriginResourceSharing

type CrossOriginResourceSharing struct {
	ExposeHeaders  []string // list of exposed Headers
	AllowedHeaders []string // list of allowed Headers
	AllowedDomains []string // list of allowed values for Http Origin. An allowed value can be a regular expression to support subdomain matching. If empty all are allowed.
	AllowedMethods []string // list of allowed Methods
	MaxAge         int      // number of seconds that indicates how long the results of a preflight request can be cached.
	CookiesAllowed bool
	Container      *restful.Container
}

CrossOriginResourceSharing is used to create a Container Filter that implements CORS. Cross-origin resource sharing (CORS) is a mechanism that allows JavaScript on a web page to make XMLHttpRequests to another domain, not the domain the JavaScript originated from.

http://en.wikipedia.org/wiki/Cross-origin_resource_sharing http://enable-cors.org/server.html https://web.dev/cross-origin-resource-sharing

func (CrossOriginResourceSharing) Filter

func (c CrossOriginResourceSharing) Filter(req *restful.Request, resp *restful.Response, chain *restful.FilterChain)

Filter is a filter function that implements the CORS flow

Jump to

Keyboard shortcuts

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