Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Casefold ¶
type Casefold struct {
// Mode selects the transformation applied to the path. Supported values:
// - "lower" (default): simple ASCII + Unicode ToLower
// - "fold": Unicode case folding (locale-independent)
// - "fs": canonicalize each existing path segment to the actual filesystem casing
Mode string `json:"mode,omitempty"`
// Root is required for mode "fs" and denotes the filesystem root directory
// that request paths are resolved against for canonical casing. If empty
// when mode=fs, the middleware skips canonicalization.
Root string `json:"root,omitempty"`
// Exclude is an optional list of glob patterns (evaluated with path.Match)
// that, if any matches the original request path, will skip rewriting.
// Patterns are matched against the leading slash form of the path.
Exclude []string `json:"exclude,omitempty"`
// Verbose enables debug logging of decisions (skips, transformations, fs lookups).
Verbose bool `json:"verbose,omitempty"`
// contains filtered or unexported fields
}
Casefold is an HTTP middleware that rewrites the request URL path using a chosen case folding strategy before other matchers/handlers run. This makes path matchers defined in the Caddyfile effectively case-insensitive (unless excluded.)
Example Caddyfile usage:
{
order casefold first
}
:8080 {
casefold {
mode fold # or "lower" (default)
exclude /api/CaseSensitive/*
exclude /downloads/*.ZIP
}
handle /Hello {
respond "Hi" 200
}
}
A request for /hello or /HeLLo will match /Hello.
func (Casefold) CaddyModule ¶
func (Casefold) CaddyModule() caddy.ModuleInfo
CaddyModule returns the Caddy module information.
Click to show internal directories.
Click to hide internal directories.