Extensions for adding request header transforms.
Inheritance
System.Object
RequestHeadersTransformExtensions
Assembly: Yarp.ReverseProxy.dll
public static class RequestHeadersTransformExtensions : object
Methods
|
Improve this Doc
View Source
Adds the transform which will copy or remove the original host header.
Declaration
public static TransformBuilderContext AddOriginalHost(this TransformBuilderContext context, bool useOriginal = true)
Parameters
Returns
|
Improve this Doc
View Source
Adds the transform which will append or set the request header.
Declaration
public static TransformBuilderContext AddRequestHeader(this TransformBuilderContext context, string headerName, string value, bool append = true)
Parameters
Type |
Name |
Description |
TransformBuilderContext |
context |
|
System.String |
headerName |
|
System.String |
value |
|
System.Boolean |
append |
|
Returns
|
Improve this Doc
View Source
Adds the transform which will remove the request header.
Declaration
public static TransformBuilderContext AddRequestHeaderRemove(this TransformBuilderContext context, string headerName)
Parameters
Returns
|
Improve this Doc
View Source
Adds the transform which will append or set the request header from a route value.
Declaration
public static TransformBuilderContext AddRequestHeaderRouteValue(this TransformBuilderContext context, string headerName, string routeValueKey, bool append = true)
Parameters
Type |
Name |
Description |
TransformBuilderContext |
context |
|
System.String |
headerName |
|
System.String |
routeValueKey |
|
System.Boolean |
append |
|
Returns
|
Improve this Doc
View Source
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.
Declaration
public static TransformBuilderContext AddRequestHeadersAllowed(this TransformBuilderContext context, params string[] allowedHeaders)
Parameters
Returns
|
Improve this Doc
View Source
Clones the route and adds the transform which will enable or suppress copying request headers to the proxy request.
Declaration
public static RouteConfig WithTransformCopyRequestHeaders(this RouteConfig route, bool copy = true)
Parameters
Type |
Name |
Description |
RouteConfig |
route |
|
System.Boolean |
copy |
|
Returns
|
Improve this Doc
View Source
Clones the route and adds the transform which will append or set the request header.
Declaration
public static RouteConfig WithTransformRequestHeader(this RouteConfig route, string headerName, string value, bool append = true)
Parameters
Type |
Name |
Description |
RouteConfig |
route |
|
System.String |
headerName |
|
System.String |
value |
|
System.Boolean |
append |
|
Returns
|
Improve this Doc
View Source
Clones the route and adds the transform which will remove the request header.
Declaration
public static RouteConfig WithTransformRequestHeaderRemove(this RouteConfig route, string headerName)
Parameters
Type |
Name |
Description |
RouteConfig |
route |
|
System.String |
headerName |
|
Returns
|
Improve this Doc
View Source
Clones the route and adds the transform which will append or set the request header from a route value.
Declaration
public static RouteConfig WithTransformRequestHeaderRouteValue(this RouteConfig route, string headerName, string routeValueKey, bool append = true)
Parameters
Type |
Name |
Description |
RouteConfig |
route |
|
System.String |
headerName |
|
System.String |
routeValueKey |
|
System.Boolean |
append |
|
Returns
|
Improve this Doc
View Source
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.
Declaration
public static RouteConfig WithTransformRequestHeadersAllowed(this RouteConfig route, params string[] allowedHeaders)
Parameters
Type |
Name |
Description |
RouteConfig |
route |
|
System.String[] |
allowedHeaders |
|
Returns
|
Improve this Doc
View Source
Clones the route and adds the transform which will copy the incoming request Host header to the proxy request.
Declaration
public static RouteConfig WithTransformUseOriginalHostHeader(this RouteConfig route, bool useOriginal = true)
Parameters
Type |
Name |
Description |
RouteConfig |
route |
|
System.Boolean |
useOriginal |
|
Returns