Skip to content

Commit

Permalink
document request_body_filter
Browse files Browse the repository at this point in the history
Includes-commit: cd6f777
Replicated-from: #402
Signed-off-by: spacewander <[email protected]>
  • Loading branch information
spacewander authored and eaufavor committed Oct 11, 2024
1 parent 894ca2d commit 9921fe4
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .bleep
Original file line number Diff line number Diff line change
@@ -1 +1 @@
8e05a8f5b9d09885e6374011c422678043a2bda0
9ec41e3e1817e36107195f6ca1a3168779857cc7
6 changes: 5 additions & 1 deletion docs/user_guide/phase.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ Pingora-proxy allows users to insert arbitrary logic into the life of a request.
Connect--connection failure-->fail_to_connect;
connected_to_upstream-->upstream_request_filter;
upstream_request_filter --> SendReq{{IO: send request to upstream}};
upstream_request_filter --> request_body_filter;
request_body_filter --> SendReq{{IO: send request to upstream}};
SendReq-->RecvResp{{IO: read response from upstream}};
RecvResp-->upstream_response_filter-->response_filter-->upstream_response_body_filter-->response_body_filter-->logging-->endreq("request done");
Expand Down Expand Up @@ -61,6 +62,9 @@ This function is similar to `request_filter()` but executes before any other log
### `request_filter()`
This phase is usually for validating request inputs, rate limiting, and initializing context.

### `request_body_filter()`
This phase is triggered after a response body is ready to send to upstream. It will be called every time a piece of request body is received.

### `proxy_upstream_filter()`
This phase determines if we should continue to the upstream to serve a response. If we short-circuit, a 502 is returned by default, but a different response can be implemented.

Expand Down
3 changes: 2 additions & 1 deletion docs/user_guide/phase_chart.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,8 @@ Pingora proxy phases without caching
Connect--connection failure-->fail_to_connect;
connected_to_upstream-->upstream_request_filter;
upstream_request_filter --> SendReq{{IO: send request to upstream}};
upstream_request_filter --> request_body_filter;
request_body_filter --> SendReq{{IO: send request to upstream}};
SendReq-->RecvResp{{IO: read response from upstream}};
RecvResp-->upstream_response_filter-->response_filter-->upstream_response_body_filter-->response_body_filter-->logging-->endreq("request done");
Expand Down

0 comments on commit 9921fe4

Please sign in to comment.