cloudflared/ingress/middleware/middleware.go
Sudarsan Reddy 7f487c2651 TUN-6775: Add middleware.Handler verification to ProxyHTTP
ProxyHTTP now processes middleware Handler before executing the request.
A chain of handlers is now executed and appropriate response status
codes are sent.
2022-09-22 15:11:59 +01:00

20 lines
411 B
Go

package middleware
import (
"context"
"net/http"
)
type HandleResult struct {
// Tells that the request didn't passed the handler and should be filtered
ShouldFilterRequest bool
// The status code to return in case ShouldFilterRequest is true.
StatusCode int
Reason string
}
type Handler interface {
Name() string
Handle(ctx context.Context, r *http.Request) (result *HandleResult, err error)
}