Table of Contents

Class HttpClientConfig

Namespace
Yarp.ReverseProxy.Configuration
Assembly
Yarp.ReverseProxy.dll

Options used for communicating with the destination servers.

public sealed record HttpClientConfig : IEquatable<HttpClientConfig>
Inheritance
HttpClientConfig
Implements
Inherited Members

Remarks

If you need a more granular approach, please use a custom implementation of IForwarderHttpClientFactory.

Constructors

HttpClientConfig()

public HttpClientConfig()

Fields

Empty

An empty options instance.

public static readonly HttpClientConfig Empty

Field Value

HttpClientConfig

Properties

DangerousAcceptAnyServerCertificate

Indicates if destination server https certificate errors should be ignored. This should only be done when using self-signed certificates.

public bool? DangerousAcceptAnyServerCertificate { get; init; }

Property Value

bool?

EnableMultipleHttp2Connections

Gets or sets a value that indicates whether additional HTTP/2 connections can be established to the same server when the maximum number of concurrent streams is reached on all existing connections.

public bool? EnableMultipleHttp2Connections { get; init; }

Property Value

bool?

MaxConnectionsPerServer

Limits the number of connections used when communicating with the destination server.

public int? MaxConnectionsPerServer { get; init; }

Property Value

int?

RequestHeaderEncoding

Allows overriding the default (ASCII) encoding for outgoing request headers.

Setting this value will in turn set RequestHeaderEncodingSelector and use the selected encoding for all request headers. The value is then parsed by GetEncoding(string), so use values like: "utf-8", "iso-8859-1", etc.

public string? RequestHeaderEncoding { get; init; }

Property Value

string

Remarks

Note: If you're using an encoding other than UTF-8 here, then you may also need to configure your server to accept request headers with such an encoding via the corresponding options for the server.

For example, when using Kestrel as the server, use RequestHeaderEncodingSelector to configure Kestrel to use the same encoding.

ResponseHeaderEncoding

Allows overriding the default (Latin1) encoding for incoming request headers.

Setting this value will in turn set ResponseHeaderEncodingSelector and use the selected encoding for all response headers. The value is then parsed by GetEncoding(string), so use values like: "utf-8", "iso-8859-1", etc.

public string? ResponseHeaderEncoding { get; init; }

Property Value

string

Remarks

Note: If you're using an encoding other than ASCII here, then you may also need to configure your server to send response headers with such an encoding via the corresponding options for the server.

For example, when using Kestrel as the server, use ResponseHeaderEncodingSelector to configure Kestrel to use the same encoding.

SslProtocols

What TLS protocols to use.

public SslProtocols? SslProtocols { get; init; }

Property Value

SslProtocols?

WebProxy

Optional web proxy used when communicating with the destination server.

public WebProxyConfig? WebProxy { get; init; }

Property Value

WebProxyConfig

Methods

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object

Returns

bool

Equals(HttpClientConfig?)

public bool Equals(HttpClientConfig? other)

Parameters

other HttpClientConfig

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string

<Clone>$()

public HttpClientConfig <Clone>$()

Returns

HttpClientConfig

Operators

operator ==(HttpClientConfig?, HttpClientConfig?)

public static bool operator ==(HttpClientConfig? left, HttpClientConfig? right)

Parameters

left HttpClientConfig
right HttpClientConfig

Returns

bool

operator !=(HttpClientConfig?, HttpClientConfig?)

public static bool operator !=(HttpClientConfig? left, HttpClientConfig? right)

Parameters

left HttpClientConfig
right HttpClientConfig

Returns

bool