|
@ -42,6 +42,7 @@ func init() { |
|
|
RegisterHandlerDirective("redir", parseRedir) |
|
|
RegisterHandlerDirective("redir", parseRedir) |
|
|
RegisterHandlerDirective("respond", parseRespond) |
|
|
RegisterHandlerDirective("respond", parseRespond) |
|
|
RegisterHandlerDirective("abort", parseAbort) |
|
|
RegisterHandlerDirective("abort", parseAbort) |
|
|
|
|
|
RegisterHandlerDirective("error", parseError) |
|
|
RegisterHandlerDirective("route", parseRoute) |
|
|
RegisterHandlerDirective("route", parseRoute) |
|
|
RegisterHandlerDirective("handle", parseHandle) |
|
|
RegisterHandlerDirective("handle", parseHandle) |
|
|
RegisterDirective("handle_errors", parseHandleErrors) |
|
|
RegisterDirective("handle_errors", parseHandleErrors) |
|
@ -566,6 +567,16 @@ func parseAbort(h Helper) (caddyhttp.MiddlewareHandler, error) { |
|
|
return &caddyhttp.StaticResponse{Abort: true}, nil |
|
|
return &caddyhttp.StaticResponse{Abort: true}, nil |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// parseError parses the error directive.
|
|
|
|
|
|
func parseError(h Helper) (caddyhttp.MiddlewareHandler, error) { |
|
|
|
|
|
se := new(caddyhttp.StaticError) |
|
|
|
|
|
err := se.UnmarshalCaddyfile(h.Dispenser) |
|
|
|
|
|
if err != nil { |
|
|
|
|
|
return nil, err |
|
|
|
|
|
} |
|
|
|
|
|
return se, nil |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
// parseRoute parses the route directive.
|
|
|
// parseRoute parses the route directive.
|
|
|
func parseRoute(h Helper) (caddyhttp.MiddlewareHandler, error) { |
|
|
func parseRoute(h Helper) (caddyhttp.MiddlewareHandler, error) { |
|
|
sr := new(caddyhttp.Subroute) |
|
|
sr := new(caddyhttp.Subroute) |
|
|