cors

package
v0.13.220 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: Apache-2.0, MIT Imports: 1 Imported by: 2

Documentation

Overview

Package cors implements the origin header for CORS.

How It Works

The filter accepts an optional variadic list of acceptable origin parameters. If the input argument list is empty, the header will always be set to '*' which means any origin is acceptable. Otherwise the header is only set if the request contains an Origin header and its value matches one of the elements in the input list. The header is only set on the response.

Usage

corsOrigin()
corsOrigin("https://www.example.org")
corsOrigin("https://www.example.org", "http://localhost:9001")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewOrigin

func NewOrigin() filters.Spec

NewOrigin creates a CORS origin handler that can check for allowed origin or set an all allowed header

Types

This section is empty.

Jump to

Keyboard shortcuts

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