Class RequestHeadersTransformExtensions
- Namespace
- Yarp.ReverseProxy.Transforms
- Assembly
- Yarp.ReverseProxy.dll
Extensions for adding request header transforms.
public static class RequestHeadersTransformExtensions
- Inheritance
-
RequestHeadersTransformExtensions
- Inherited Members
Methods
AddOriginalHost(TransformBuilderContext, bool)
Adds the transform which will copy or remove the original host header.
public static TransformBuilderContext AddOriginalHost(this TransformBuilderContext context, bool useOriginal = true)
Parameters
context
TransformBuilderContextuseOriginal
bool
Returns
AddRequestHeader(TransformBuilderContext, string, string, bool)
Adds the transform which will append or set the request header.
public static TransformBuilderContext AddRequestHeader(this TransformBuilderContext context, string headerName, string value, bool append = true)
Parameters
context
TransformBuilderContextheaderName
stringvalue
stringappend
bool
Returns
AddRequestHeaderRemove(TransformBuilderContext, string)
Adds the transform which will remove the request header.
public static TransformBuilderContext AddRequestHeaderRemove(this TransformBuilderContext context, string headerName)
Parameters
context
TransformBuilderContextheaderName
string
Returns
AddRequestHeaderRouteValue(TransformBuilderContext, string, string, bool)
Adds the transform which will append or set the request header from a route value.
public static TransformBuilderContext AddRequestHeaderRouteValue(this TransformBuilderContext context, string headerName, string routeValueKey, bool append = true)
Parameters
context
TransformBuilderContextheaderName
stringrouteValueKey
stringappend
bool
Returns
AddRequestHeadersAllowed(TransformBuilderContext, params string[])
Adds the transform which will only copy the allowed request headers. Other transforms that modify or append to existing headers may be affected if not included in the allow list.
public static TransformBuilderContext AddRequestHeadersAllowed(this TransformBuilderContext context, params string[] allowedHeaders)
Parameters
context
TransformBuilderContextallowedHeaders
string[]
Returns
WithTransformCopyRequestHeaders(RouteConfig, bool)
Clones the route and adds the transform which will enable or suppress copying request headers to the proxy request.
public static RouteConfig WithTransformCopyRequestHeaders(this RouteConfig route, bool copy = true)
Parameters
route
RouteConfigcopy
bool
Returns
WithTransformRequestHeader(RouteConfig, string, string, bool)
Clones the route and adds the transform which will append or set the request header.
public static RouteConfig WithTransformRequestHeader(this RouteConfig route, string headerName, string value, bool append = true)
Parameters
route
RouteConfigheaderName
stringvalue
stringappend
bool
Returns
WithTransformRequestHeaderRemove(RouteConfig, string)
Clones the route and adds the transform which will remove the request header.
public static RouteConfig WithTransformRequestHeaderRemove(this RouteConfig route, string headerName)
Parameters
route
RouteConfigheaderName
string
Returns
WithTransformRequestHeaderRouteValue(RouteConfig, string, string, bool)
Clones the route and adds the transform which will append or set the request header from a route value.
public static RouteConfig WithTransformRequestHeaderRouteValue(this RouteConfig route, string headerName, string routeValueKey, bool append = true)
Parameters
route
RouteConfigheaderName
stringrouteValueKey
stringappend
bool
Returns
WithTransformRequestHeadersAllowed(RouteConfig, params string[])
Clones the route and adds the transform which will only copy the allowed request headers. Other transforms that modify or append to existing headers may be affected if not included in the allow list.
public static RouteConfig WithTransformRequestHeadersAllowed(this RouteConfig route, params string[] allowedHeaders)
Parameters
route
RouteConfigallowedHeaders
string[]
Returns
WithTransformUseOriginalHostHeader(RouteConfig, bool)
Clones the route and adds the transform which will copy the incoming request Host header to the proxy request.
public static RouteConfig WithTransformUseOriginalHostHeader(this RouteConfig route, bool useOriginal = true)
Parameters
route
RouteConfiguseOriginal
bool