Documentation
¶
Overview ¶
Package hostpolicy gates all content on resolved alternate hosts. Compose it outside every application wrapper; it neither provisions tenants nor grants CMS access. Credentials are owner supplied and stored only as bcrypt hashes.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanonicalURL ¶
CanonicalURL is intended for callers that need a safe public canonical hint.
Types ¶
type Config ¶
type Config struct {
AdminHost, PlatformHost string
Policies map[string]Policy
Resolve func(context.Context, string) (Tenant, bool)
TrustedProxies []netip.Prefix
Transport TransportMode
// PreviewAccess optionally verifies host-owned, scoped preview authority on
// every eligible request. It is considered only for protected preview tenants,
// after transport/canonical policy checks, for canonical content GET/HEAD
// targets without queries, or explicitly declared query targets below. Basic
// authentication and all privileged routes keep their existing gates. The
// callback must verify the exact origin, path AND raw query, tenant,
// audience and current grant; it grants no CMS/admin authority. Nil or false
// preserves Basic authentication. Its request clone must not be retained.
PreviewAccess func(*http.Request, Tenant) bool
// PreviewAccessQueryTargets is an optional finite per-tenant ceiling, derived
// from validated host declarations. Only exact canonical GET/HEAD targets may
// reach PreviewAccess. A nil/empty map retains the default query denial; these
// declarations confer no authority without the callback's current grant check.
PreviewAccessQueryTargets map[int64][]string
}
type TransportMode ¶
type TransportMode string
TransportMode describes the deployment's HTTPS boundary, never client input.
const ( TransportStrict TransportMode = "strict" TransportAppPlatformHTTPS TransportMode = "app-platform-https" )
Click to show internal directories.
Click to hide internal directories.