MCPcopy
hub / github.com/caddyserver/caddy / Intercept

Struct Intercept

modules/caddyhttp/intercept/intercept.go:45–65  ·  view source on GitHub ↗

Intercept is a middleware that intercepts then replaces or modifies the original response. It can, for instance, be used to implement X-Sendfile/X-Accel-Redirect-like features when using modules like FrankenPHP or Caddy Snake. EXPERIMENTAL: Subject to change or removal.

Source from the content-addressed store, hash-verified

43//
44// EXPERIMENTAL: Subject to change or removal.
45type Intercept struct {
46 // List of handlers and their associated matchers to evaluate
47 // after successful response generation.
48 // The first handler that matches the original response will
49 // be invoked. The original response body will not be
50 // written to the client;
51 // it is up to the handler to finish handling the response.
52 //
53 // Three new placeholders are available in this handler chain:
54 // - `{http.intercept.status_code}` The status code from the response
55 // - `{http.intercept.header.*}` The headers from the response
56 HandleResponse []caddyhttp.ResponseHandler `json:"handle_response,omitempty"`
57
58 // Holds the named response matchers from the Caddyfile while adapting
59 responseMatchers map[string]caddyhttp.ResponseMatcher
60
61 // Holds the handle_response Caddyfile tokens while adapting
62 handleResponseSegments []*caddyfile.Dispenser
63
64 logger *zap.Logger
65}
66
67// CaddyModule returns the Caddy module information.
68//

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected