Table of Contents

Interface IHttpForwarder

Namespace
Yarp.ReverseProxy.Forwarder
Assembly
Yarp.ReverseProxy.dll

Forward an HTTP request to a chosen destination.

public interface IHttpForwarder
Extension Methods

Methods

SendAsync(HttpContext, string, HttpMessageInvoker, ForwarderRequestConfig, HttpTransformer)

Forwards the incoming request to the destination server, and the response back to the client.

ValueTask<ForwarderError> SendAsync(HttpContext context, string destinationPrefix, HttpMessageInvoker httpClient, ForwarderRequestConfig requestConfig, HttpTransformer transformer)

Parameters

context HttpContext

The HttpContext to forward.

destinationPrefix string

The url prefix for where to forward the request to.

httpClient HttpMessageInvoker

The HTTP client used to forward the request.

requestConfig ForwarderRequestConfig

Config for the outgoing request.

transformer HttpTransformer

Request and response transforms. Use Default if custom transformations are not needed.

Returns

ValueTask<ForwarderError>

The result of forwarding the request and response.

SendAsync(HttpContext, string, HttpMessageInvoker, ForwarderRequestConfig, HttpTransformer, CancellationToken)

Forwards the incoming request to the destination server, and the response back to the client.

ValueTask<ForwarderError> SendAsync(HttpContext context, string destinationPrefix, HttpMessageInvoker httpClient, ForwarderRequestConfig requestConfig, HttpTransformer transformer, CancellationToken cancellationToken)

Parameters

context HttpContext

The HttpContext to forward.

destinationPrefix string

The url prefix for where to forward the request to.

httpClient HttpMessageInvoker

The HTTP client used to forward the request.

requestConfig ForwarderRequestConfig

Config for the outgoing request.

transformer HttpTransformer

Request and response transforms. Use Default if custom transformations are not needed.

cancellationToken CancellationToken

A cancellation token that can be used to abort the request.

Returns

ValueTask<ForwarderError>

The result of forwarding the request and response.