Documentation ¶
Index ¶
- type Intercept
- func (i *Intercept) FinalizeUnmarshalKenginefile(helper httpkenginefile.Helper) error
- func (Intercept) KengineModule() kengine.ModuleInfo
- func (irh *Intercept) Provision(ctx kengine.Context) error
- func (ir Intercept) ServeHTTP(w http.ResponseWriter, r *http.Request, next kenginehttp.Handler) error
- func (i *Intercept) UnmarshalKenginefile(d *kenginefile.Dispenser) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Intercept ¶
type Intercept struct { // List of handlers and their associated matchers to evaluate // after successful response generation. // The first handler that matches the original response will // be invoked. The original response body will not be // written to the client; // it is up to the handler to finish handling the response. // // Three new placeholders are available in this handler chain: // - `{http.intercept.status_code}` The status code from the response // - `{http.intercept.header.*}` The headers from the response HandleResponse []kenginehttp.ResponseHandler `json:"handle_response,omitempty"` // contains filtered or unexported fields }
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 Kengine Snake.
EXPERIMENTAL: Subject to change or removal.
func (*Intercept) FinalizeUnmarshalKenginefile ¶
func (i *Intercept) FinalizeUnmarshalKenginefile(helper httpkenginefile.Helper) error
FinalizeUnmarshalKenginefile finalizes the Kenginefile parsing which requires having an httpkenginefile.Helper to function, to parse subroutes.
EXPERIMENTAL: Subject to change or removal.
func (Intercept) KengineModule ¶
func (Intercept) KengineModule() kengine.ModuleInfo
KengineModule returns the Kengine module information.
EXPERIMENTAL: Subject to change or removal.
func (*Intercept) Provision ¶
Provision ensures that i is set up properly before use.
EXPERIMENTAL: Subject to change or removal.
func (Intercept) ServeHTTP ¶
func (ir Intercept) ServeHTTP(w http.ResponseWriter, r *http.Request, next kenginehttp.Handler) error
EXPERIMENTAL: Subject to change or removal.
func (*Intercept) UnmarshalKenginefile ¶
func (i *Intercept) UnmarshalKenginefile(d *kenginefile.Dispenser) error
UnmarshalKenginefile sets up the handler from Kenginefile tokens. Syntax:
intercept [<matcher>] { # intercept original responses @name { status <code...> header <field> [<value>] } replace_status [<matcher>] <status_code> handle_response [<matcher>] { <directives...> } }
The FinalizeUnmarshalKenginefile method should be called after this to finalize parsing of "handle_response" blocks, if possible.
EXPERIMENTAL: Subject to change or removal.