schemehost

package
v3.7.0 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package schemehost compares the scheme and host of two URLs for same-origin checks. It is shared by the CSRF middleware (Origin/Referer validation), the core redirect logic (open-redirect prevention) and the proxy Balancer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Match

func Match(schemeA, hostA, schemeB, hostB string) bool

Match reports whether (schemeA, hostA) and (schemeB, hostB) denote the same origin. Scheme comparison is case-insensitive and default ports (http:80, https:443) are normalized so "example.com" and "example.com:443" match.

func MatchStrict added in v3.7.0

func MatchStrict(scheme, hostA, hostB string) bool

MatchStrict is Match for one scheme without the url.Parse fallback: a value that is not a plain host with an optional port matches nothing, so no other parser can read it as another host.

Types

This section is empty.

Jump to

Keyboard shortcuts

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