Versions in this module Expand all Collapse all v2 v2.3.1 Mar 22, 2021 Changes in this version + const DefaultHTTPPort + const DefaultHTTPSPort + const ErrorCtxKey + const OriginalRequestCtxKey + const ServerCtxKey + const VarsCtxKey + var ErrNotImplemented = fmt.Errorf("method not implemented") + func GetVar(ctx context.Context, key string) interface + func NewTestReplacer(req *http.Request) *caddy.Replacer + func PrepareRequest(r *http.Request, repl *caddy.Replacer, w http.ResponseWriter, s *Server) *http.Request + func SetVar(ctx context.Context, key string, value interface{}) + func StatusCodeMatches(actual, configured int) bool + type App struct + GracePeriod caddy.Duration + HTTPPort int + HTTPSPort int + Servers map[string]*Server + func (App) CaddyModule() caddy.ModuleInfo + func (app *App) Provision(ctx caddy.Context) error + func (app *App) Start() error + func (app *App) Stop() error + func (app *App) Validate() error + type AutoHTTPSConfig struct + DisableRedir bool + Disabled bool + IgnoreLoadedCerts bool + Skip []string + SkipCerts []string + func (ahc AutoHTTPSConfig) Skipped(name string, skipSlice []string) bool + type HTTPErrorConfig struct + Routes RouteList + func (*HTTPErrorConfig) WithError(r *http.Request, err error) *http.Request + type HTTPInterfaces interface + type Handler interface + ServeHTTP func(http.ResponseWriter, *http.Request) error + type HandlerError struct + Err error + ID string + StatusCode int + Trace string + func Error(statusCode int, err error) HandlerError + func (e HandlerError) Error() string + type HandlerFunc func(http.ResponseWriter, *http.Request) error + func (f HandlerFunc) ServeHTTP(w http.ResponseWriter, r *http.Request) error + type LoggableHTTPHeader http.Header + func (h LoggableHTTPHeader) MarshalLogObject(enc zapcore.ObjectEncoder) error + type LoggableHTTPRequest struct + func (r LoggableHTTPRequest) MarshalLogObject(enc zapcore.ObjectEncoder) error + type LoggableStringArray []string + func (sa LoggableStringArray) MarshalLogArray(enc zapcore.ArrayEncoder) error + type LoggableTLSConnState tls.ConnectionState + func (t LoggableTLSConnState) MarshalLogObject(enc zapcore.ObjectEncoder) error + type MatchExpression struct + Expr string + func (MatchExpression) CaddyModule() caddy.ModuleInfo + func (m *MatchExpression) Provision(_ caddy.Context) error + func (m *MatchExpression) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m *MatchExpression) UnmarshalJSON(data []byte) error + func (m MatchExpression) MarshalJSON() ([]byte, error) + func (m MatchExpression) Match(r *http.Request) bool + type MatchHeader http.Header + func (MatchHeader) CaddyModule() caddy.ModuleInfo + func (m *MatchHeader) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m MatchHeader) Match(r *http.Request) bool + type MatchHeaderRE map[string]*MatchRegexp + func (MatchHeaderRE) CaddyModule() caddy.ModuleInfo + func (m *MatchHeaderRE) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m MatchHeaderRE) Match(r *http.Request) bool + func (m MatchHeaderRE) Provision(ctx caddy.Context) error + func (m MatchHeaderRE) Validate() error + type MatchHost []string + func (MatchHost) CaddyModule() caddy.ModuleInfo + func (m *MatchHost) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m MatchHost) Match(r *http.Request) bool + func (m MatchHost) Provision(_ caddy.Context) error + type MatchMethod []string + func (MatchMethod) CaddyModule() caddy.ModuleInfo + func (m *MatchMethod) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m MatchMethod) Match(r *http.Request) bool + type MatchNot struct + MatcherSets []MatcherSet + MatcherSetsRaw []caddy.ModuleMap + func (MatchNot) CaddyModule() caddy.ModuleInfo + func (m *MatchNot) Provision(ctx caddy.Context) error + func (m *MatchNot) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m *MatchNot) UnmarshalJSON(data []byte) error + func (m MatchNot) MarshalJSON() ([]byte, error) + func (m MatchNot) Match(r *http.Request) bool + type MatchPath []string + func (MatchPath) CaddyModule() caddy.ModuleInfo + func (m *MatchPath) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m MatchPath) Match(r *http.Request) bool + func (m MatchPath) Provision(_ caddy.Context) error + type MatchPathRE struct + func (MatchPathRE) CaddyModule() caddy.ModuleInfo + func (m MatchPathRE) Match(r *http.Request) bool + type MatchProtocol string + func (MatchProtocol) CaddyModule() caddy.ModuleInfo + func (m *MatchProtocol) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m MatchProtocol) Match(r *http.Request) bool + type MatchQuery url.Values + func (MatchQuery) CaddyModule() caddy.ModuleInfo + func (m *MatchQuery) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m MatchQuery) Match(r *http.Request) bool + type MatchRegexp struct + Name string + Pattern string + func (mre *MatchRegexp) Match(input string, repl *caddy.Replacer) bool + func (mre *MatchRegexp) Provision(caddy.Context) error + func (mre *MatchRegexp) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (mre *MatchRegexp) Validate() error + type MatchRemoteIP struct + Forwarded bool + Ranges []string + func (MatchRemoteIP) CaddyModule() caddy.ModuleInfo + func (m *MatchRemoteIP) Provision(ctx caddy.Context) error + func (m *MatchRemoteIP) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m MatchRemoteIP) Match(r *http.Request) bool + type MatchVarsRE map[string]*MatchRegexp + func (MatchVarsRE) CaddyModule() caddy.ModuleInfo + func (m *MatchVarsRE) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m MatchVarsRE) Match(r *http.Request) bool + func (m MatchVarsRE) Provision(ctx caddy.Context) error + func (m MatchVarsRE) Validate() error + type MatcherSet []RequestMatcher + func (mset MatcherSet) Match(r *http.Request) bool + type MatcherSets []MatcherSet + func (ms *MatcherSets) FromInterface(matcherSets interface{}) error + func (ms MatcherSets) AnyMatch(req *http.Request) bool + type Middleware func(Handler) Handler + type MiddlewareHandler interface + ServeHTTP func(http.ResponseWriter, *http.Request, Handler) error + type RawMatcherSets []caddy.ModuleMap + type RequestMatcher interface + Match func(*http.Request) bool + type ResponseHandler struct + Match *ResponseMatcher + Routes RouteList + StatusCode WeakString + func (rh *ResponseHandler) Provision(ctx caddy.Context) error + type ResponseMatcher struct + Headers http.Header + StatusCode []int + func (rm ResponseMatcher) Match(statusCode int, hdr http.Header) bool + type ResponseRecorder interface + Buffer func() *bytes.Buffer + Buffered func() bool + Size func() int + Status func() int + WriteResponse func() error + func NewResponseRecorder(w http.ResponseWriter, buf *bytes.Buffer, shouldBuffer ShouldBufferFunc) ResponseRecorder + type ResponseWriterWrapper struct + func (rww *ResponseWriterWrapper) Flush() + func (rww *ResponseWriterWrapper) Hijack() (net.Conn, *bufio.ReadWriter, error) + func (rww *ResponseWriterWrapper) Push(target string, opts *http.PushOptions) error + type Route struct + Group string + Handlers []MiddlewareHandler + HandlersRaw []json.RawMessage + MatcherSets MatcherSets + MatcherSetsRaw RawMatcherSets + Terminal bool + func (r Route) Empty() bool + type RouteList []Route + func (routes RouteList) Compile(next Handler) Handler + func (routes RouteList) Provision(ctx caddy.Context) error + func (routes RouteList) ProvisionHandlers(ctx caddy.Context) error + func (routes RouteList) ProvisionMatchers(ctx caddy.Context) error + type Server struct + AllowH2C bool + AutoHTTPS *AutoHTTPSConfig + Errors *HTTPErrorConfig + ExperimentalHTTP3 bool + IdleTimeout caddy.Duration + Listen []string + ListenerWrappersRaw []json.RawMessage + Logs *ServerLogConfig + MaxHeaderBytes int + ReadHeaderTimeout caddy.Duration + ReadTimeout caddy.Duration + Routes RouteList + StrictSNIHost *bool + TLSConnPolicies caddytls.ConnectionPolicies + WriteTimeout caddy.Duration + func (s *Server) ServeHTTP(w http.ResponseWriter, r *http.Request) + type ServerLogConfig struct + DefaultLoggerName string + LoggerNames map[string]string + SkipHosts []string + SkipUnmappedHosts bool + type ShouldBufferFunc func(status int, header http.Header) bool + type StaticError struct + Error string + StatusCode WeakString + func (StaticError) CaddyModule() caddy.ModuleInfo + func (e StaticError) ServeHTTP(w http.ResponseWriter, r *http.Request, _ Handler) error + type StaticResponse struct + Body string + Close bool + Headers http.Header + StatusCode WeakString + func (StaticResponse) CaddyModule() caddy.ModuleInfo + func (s *StaticResponse) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (s StaticResponse) ServeHTTP(w http.ResponseWriter, r *http.Request, _ Handler) error + type Subroute struct + Errors *HTTPErrorConfig + Routes RouteList + func (Subroute) CaddyModule() caddy.ModuleInfo + func (sr *Subroute) Provision(ctx caddy.Context) error + func (sr *Subroute) ServeHTTP(w http.ResponseWriter, r *http.Request, next Handler) error + type VarsMatcher map[string]string + func (VarsMatcher) CaddyModule() caddy.ModuleInfo + func (m *VarsMatcher) UnmarshalCaddyfile(d *caddyfile.Dispenser) error + func (m VarsMatcher) Match(r *http.Request) bool + type VarsMiddleware map[string]string + func (VarsMiddleware) CaddyModule() caddy.ModuleInfo + func (t VarsMiddleware) ServeHTTP(w http.ResponseWriter, r *http.Request, next Handler) error + type WeakString string + func (ws *WeakString) UnmarshalJSON(b []byte) error + func (ws WeakString) Bool() bool + func (ws WeakString) Float64() float64 + func (ws WeakString) Int() int + func (ws WeakString) MarshalJSON() ([]byte, error) + func (ws WeakString) String() string