Internal

internal/schemehost

import "github.com/gofiber/fiber/v3/internal/schemehost"

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.

Functions

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

Source: internal/schemehost/schemehost.go:46

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(scheme, hostA, hostB string) bool

Source: internal/schemehost/schemehost.go:94

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.