Documentation
¶
Index ¶
- func ConvertRules(routes []RouteRuleConfig) (routeRules *[]RouteRule, err error)
- func RedirectRequest(r *http.Request, newURL string) (newRequest *http.Request, err error)
- func RouteAll(rules []RouteRule) func(http.ResponseWriter, *http.Request)
- type Config
- type RewriteRule
- type RewriteRuleConfig
- type RouteRule
- type RouteRuleConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ConvertRules ¶
func ConvertRules(routes []RouteRuleConfig) (routeRules *[]RouteRule, err error)
ConvertRules converts RouteRuleConfigs to RouteRules
func RedirectRequest ¶
RedirectRequest copies a request and changes the URL
Types ¶
type Config ¶
type Config struct {
Routes []RouteRuleConfig `json:"routes"`
}
Config holds configuration details for the reverse proxy
type RewriteRule ¶
A RewriteRule describes how to modify the path for a request
func NewRewriteRule ¶
func NewRewriteRule(config RewriteRuleConfig) (rule *RewriteRule, err error)
NewRewriteRule converts a RewriteRuleConfig to a RewriteRule
type RewriteRuleConfig ¶
A RewriteRuleConfig is the on-disk representation of a RewriteRule
type RouteRule ¶
type RouteRule struct {
Match *regexp.Regexp
Rewrite RewriteRule
Destination string
WebSocketOptions relay.Options
}
A RouteRule describes which paths to match, how to rewrite the request, and where to reroute the request
func NewRouteRule ¶
func NewRouteRule(config RouteRuleConfig) (rule *RouteRule, err error)
NewRouteRule converts a RouteRuleConfig to a RouteRule
func (RouteRule) RewriteLocation ¶
RewriteLocation converts a request path to the redirected location
func (RouteRule) RewritePath ¶
RewritePath converts a request path to the redirected path
type RouteRuleConfig ¶
type RouteRuleConfig struct {
Match string `json:"match"`
Rewrite RewriteRuleConfig `json:"rewrite"`
Destination string `json:"destination"`
}
A RouteRuleConfig is the on-disk representation of a RouteRule