Table of Contents

Class ForwardedTransformExtensions

Namespace
Yarp.ReverseProxy.Transforms
Assembly
Yarp.ReverseProxy.dll

Extensions for adding forwarded header transforms.

public static class ForwardedTransformExtensions
Inheritance
ForwardedTransformExtensions
Inherited Members

Methods

AddClientCertHeader(TransformBuilderContext, string)

Adds the transform which will set the given header with the Base64 encoded client certificate.

public static TransformBuilderContext AddClientCertHeader(this TransformBuilderContext context, string headerName)

Parameters

context TransformBuilderContext
headerName string

Returns

TransformBuilderContext

AddForwarded(TransformBuilderContext, bool, bool, NodeFormat, NodeFormat, ForwardedTransformActions)

Adds the transform which will add the Forwarded header as defined by RFC 7239.

public static TransformBuilderContext AddForwarded(this TransformBuilderContext context, bool useHost = true, bool useProto = true, NodeFormat forFormat = NodeFormat.Random, NodeFormat byFormat = NodeFormat.Random, ForwardedTransformActions action = ForwardedTransformActions.Set)

Parameters

context TransformBuilderContext
useHost bool
useProto bool
forFormat NodeFormat
byFormat NodeFormat
action ForwardedTransformActions

Returns

TransformBuilderContext

AddXForwarded(TransformBuilderContext, ForwardedTransformActions)

Adds the transform which will add X-Forwarded-* request headers.

public static TransformBuilderContext AddXForwarded(this TransformBuilderContext context, ForwardedTransformActions action = ForwardedTransformActions.Set)

Parameters

context TransformBuilderContext
action ForwardedTransformActions

Returns

TransformBuilderContext

AddXForwardedFor(TransformBuilderContext, string, ForwardedTransformActions)

Adds the transform which will add X-Forwarded-For request header.

public static TransformBuilderContext AddXForwardedFor(this TransformBuilderContext context, string headerName = "X-Forwarded-For", ForwardedTransformActions action = ForwardedTransformActions.Set)

Parameters

context TransformBuilderContext
headerName string
action ForwardedTransformActions

Returns

TransformBuilderContext

AddXForwardedHost(TransformBuilderContext, string, ForwardedTransformActions)

Adds the transform which will add X-Forwarded-Host request header.

public static TransformBuilderContext AddXForwardedHost(this TransformBuilderContext context, string headerName = "X-Forwarded-Host", ForwardedTransformActions action = ForwardedTransformActions.Set)

Parameters

context TransformBuilderContext
headerName string
action ForwardedTransformActions

Returns

TransformBuilderContext

AddXForwardedPrefix(TransformBuilderContext, string, ForwardedTransformActions)

Adds the transform which will add X-Forwarded-Prefix request header.

public static TransformBuilderContext AddXForwardedPrefix(this TransformBuilderContext context, string headerName = "X-Forwarded-Prefix", ForwardedTransformActions action = ForwardedTransformActions.Set)

Parameters

context TransformBuilderContext
headerName string
action ForwardedTransformActions

Returns

TransformBuilderContext

AddXForwardedProto(TransformBuilderContext, string, ForwardedTransformActions)

Adds the transform which will add X-Forwarded-Proto request header.

public static TransformBuilderContext AddXForwardedProto(this TransformBuilderContext context, string headerName = "X-Forwarded-Proto", ForwardedTransformActions action = ForwardedTransformActions.Set)

Parameters

context TransformBuilderContext
headerName string
action ForwardedTransformActions

Returns

TransformBuilderContext

WithTransformClientCertHeader(RouteConfig, string)

Clones the route and adds the transform which will set the given header with the Base64 encoded client certificate.

public static RouteConfig WithTransformClientCertHeader(this RouteConfig route, string headerName)

Parameters

route RouteConfig
headerName string

Returns

RouteConfig

WithTransformForwarded(RouteConfig, bool, bool, NodeFormat, NodeFormat, ForwardedTransformActions)

Clones the route and adds the transform which will add the Forwarded header as defined by RFC 7239.

public static RouteConfig WithTransformForwarded(this RouteConfig route, bool useHost = true, bool useProto = true, NodeFormat forFormat = NodeFormat.Random, NodeFormat byFormat = NodeFormat.Random, ForwardedTransformActions action = ForwardedTransformActions.Set)

Parameters

route RouteConfig
useHost bool
useProto bool
forFormat NodeFormat
byFormat NodeFormat
action ForwardedTransformActions

Returns

RouteConfig

WithTransformXForwarded(RouteConfig, string, ForwardedTransformActions, ForwardedTransformActions?, ForwardedTransformActions?, ForwardedTransformActions?, ForwardedTransformActions?)

Clones the route and adds the transform which will add X-Forwarded-* headers.

public static RouteConfig WithTransformXForwarded(this RouteConfig route, string headerPrefix = "X-Forwarded-", ForwardedTransformActions xDefault = ForwardedTransformActions.Set, ForwardedTransformActions? xFor = null, ForwardedTransformActions? xHost = null, ForwardedTransformActions? xProto = null, ForwardedTransformActions? xPrefix = null)

Parameters

route RouteConfig
headerPrefix string
xDefault ForwardedTransformActions
xFor ForwardedTransformActions?
xHost ForwardedTransformActions?
xProto ForwardedTransformActions?
xPrefix ForwardedTransformActions?

Returns

RouteConfig