 Documentation
      ¶
      Documentation
      ¶
    
    
  
    
  
    Overview ¶
Package rewrite is middleware for rewriting requests internally to a different path.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type RegexpRule ¶ added in v0.7.0
type RegexpRule struct {
	// Path base. Request to this path and subpaths will be rewritten
	Base string
	// Path to rewrite to
	To string
	// Extensions to filter by
	Exts []string
	*regexp.Regexp
}
    RegexpRule is a rewrite rule based on a regular expression
func NewRegexpRule ¶ added in v0.7.0
func NewRegexpRule(base, pattern, to string, ext []string) (*RegexpRule, error)
NewRegexpRule creates a new RegexpRule. It returns an error if regexp pattern (pattern) or extensions (ext) are invalid.
type Rewrite ¶
type Rewrite struct {
	Next  middleware.Handler
	Rules []Rule
}
    Rewrite is middleware to rewrite request locations internally before being handled.
type Rule ¶ added in v0.6.0
type Rule interface {
	// Rewrite rewrites the internal location of the current request.
	Rewrite(*http.Request) bool
}
    Rule describes an internal location rewrite rule.
type SimpleRule ¶ added in v0.7.0
type SimpleRule struct {
	From, To string
}
    SimpleRule is a simple rewrite rule.
func NewSimpleRule ¶ added in v0.7.0
func NewSimpleRule(from, to string) SimpleRule
NewSimpleRule creates a new Simple Rule
 Click to show internal directories. 
   Click to hide internal directories.