Skip to main content

proxy

Function proxy 

Source
pub async fn proxy(
    req: Request<Incoming>,
    client: Client<HttpsConnector<HttpConnector>, Incoming>,
    config: Arc<Config>,
) -> Result<Response<BoxBody<Bytes, Box<dyn Error + Send + Sync>>>, Error>
Expand description

Process a single request through the proxy

This implementation ALWAYS streams backend responses (nginx-style):

  • No buffering of response body
  • Direct streaming from backend to client
  • Works for both SSE and regular HTTP
  • Optimal performance and memory usage

For direct responses (Respond directive) and errors, buffering is used since these are small and generated by the proxy itself