Documentation
¶
Overview ¶
Package rewrite performs bounded internal request rewrites.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(rules ...Rule) fh.HandlerFunc
func WithConfig ¶
func WithConfig(cfg Config) fh.HandlerFunc
Types ¶
type Rule ¶
type Rule struct {
From string
To string
Methods []string
Host string // exact host or *.example.com; port is optional
Headers map[string]string // "*" means the header only needs to exist
Query map[string]string // "*" means the query key only needs to exist
When func(fh.Ctx) bool
}
Rule matches a request and internally reroutes it to To. From uses exactly the router's syntax and matcher: static paths, :named parameters, and terminal * or *named wildcards. Targets may reference captures as :name, {name}, *name, {name}, or * for an unnamed wildcard.
Click to show internal directories.
Click to hide internal directories.