cors

package
v1.6.29 Latest Latest
Warning

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

Go to latest
Published: Sep 19, 2026 License: AGPL-3.0 Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package cors provides shared browser CORS origin normalization helpers.

Index

Constants

View Source
const DenyAllAllowlist = "https://invalid.invalid/lesser-cors-deny-all"

DenyAllAllowlist is a syntactically invalid origin-list sentinel used when an operator supplied only invalid origins. Runtime parsers ignore it and deploy templates never match it, preserving fail-closed behavior without falling back to the instance-origin default.

Variables

This section is empty.

Functions

func NormalizeAllowedOriginsForDeploy

func NormalizeAllowedOriginsForDeploy(raw string) string

NormalizeAllowedOriginsForDeploy normalizes a comma-separated allowlist before it is embedded in deploy-time infrastructure. An empty raw value means "use the instance-origin default". A non-empty raw value with no valid entries returns DenyAllAllowlist so deploy-time preflights fail closed instead of accidentally reverting to the default origin.

func NormalizeOrigin

func NormalizeOrigin(raw string) (string, *url.URL, bool)

NormalizeOrigin returns a normalized origin string and parsed URL when raw is exactly an origin. Paths other than '/', queries, fragments, opaque URLs, and userinfo are rejected.

func ParseAllowedOrigins

func ParseAllowedOrigins(raw string) []string

ParseAllowedOrigins parses a comma-separated CORS allowlist for runtime use. Invalid entries are ignored fail-closed. A literal '*' is preserved only when explicitly supplied.

Types

This section is empty.

Jump to

Keyboard shortcuts

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