mirror of
https://github.com/cloudflare/cloudflared.git
synced 2025-07-27 22:19:58 +00:00
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.
This commit is contained in:
@@ -5,6 +5,15 @@ import (
|
||||
"net/http"
|
||||
)
|
||||
|
||||
type Handler interface {
|
||||
Handle(ctx context.Context, r *http.Request) error
|
||||
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)
|
||||
}
|
||||
|
Reference in New Issue
Block a user