Skip to content
Docs Try Aspire

Aspire.Hosting.Yarp

Official
📦 Aspire.Hosting.Yarp v13.2.0
60 Functions
25 Types

Types

Functions

function addCatchAllRoute
Adds a YARP catch-all route for an existing cluster.
addCatchAllRoute(cluster: YarpCluster): YarpRoute
function addCatchAllRouteFromEndpoint
Adds a YARP catch-all route for an endpoint reference.
addCatchAllRouteFromEndpoint(endpoint: EndpointReference): YarpRoute
function addCatchAllRouteFromExternalService
Adds a YARP catch-all route for an external service resource.
addCatchAllRouteFromExternalService(externalService: ExternalServiceResource): YarpRoute
function addCatchAllRouteFromResource
Adds a YARP catch-all route for a resource that supports service discovery.
addCatchAllRouteFromResource(resource: IResourceWithServiceDiscovery): YarpRoute
function addClusterFromEndpoint
Adds a YARP cluster for an endpoint reference.
addClusterFromEndpoint(endpoint: EndpointReference): YarpCluster
function addClusterFromExternalService
Adds a YARP cluster for an external service resource.
addClusterFromExternalService(externalService: ExternalServiceResource): YarpCluster
function addClusterFromResource
Adds a YARP cluster for a resource that supports service discovery.
addClusterFromResource(resource: IResourceWithServiceDiscovery): YarpCluster
function addClusterWithDestination
Adds a YARP cluster with a single destination.
addClusterWithDestination(clusterName: string, destination: any): YarpCluster
function addClusterWithDestinations
Adds a YARP cluster with multiple destinations.
addClusterWithDestinations(clusterName: string, destinations: any[]): YarpCluster
function addRouteFromEndpoint
Adds a YARP route for an endpoint reference.
addRouteFromEndpoint(path: string, endpoint: EndpointReference): YarpRoute
function addRouteFromExternalService
Adds a YARP route for an external service resource.
addRouteFromExternalService(path: string, externalService: ExternalServiceResource): YarpRoute
function addRouteFromResource
Adds a YARP route for a resource that supports service discovery.
addRouteFromResource(path: string, resource: IResourceWithServiceDiscovery): YarpRoute
function addYarp builder
Adds a YARP container to the application model.
addYarp(name: string): YarpResource
function publishWithStaticFiles builder
In publish mode, generates a Dockerfile that copies static files from the specified resource into /app/wwwroot.
publishWithStaticFiles(resourceWithFiles: IResourceWithContainerFiles): YarpResource
function withConfiguration builder
Configure the YARP resource.
withConfiguration(configurationBuilder: (obj: IYarpConfigurationBuilder) => void): YarpResource
function withForwarderRequestConfig
Sets the forwarder request configuration for the cluster.
withForwarderRequestConfig(config: YarpForwarderRequestConfig): YarpCluster
function withHealthCheckConfig
Sets the health check configuration for the cluster.
withHealthCheckConfig(config: YarpHealthCheckConfig): YarpCluster
function withHostHttpsPort builder
Configures the host HTTPS port that the YARP resource is exposed on instead of using randomly assigned port.
withHostHttpsPort(port: number): YarpResource
function withHostPort builder
Configures the host port that the YARP resource is exposed on instead of using randomly assigned port.
withHostPort(port: number): YarpResource
function withHttpClientConfig
Sets the HTTP client configuration for the cluster.
withHttpClientConfig(config: YarpHttpClientConfig): YarpCluster
function withLoadBalancingPolicy
Sets the load balancing policy for the cluster.
withLoadBalancingPolicy(policy: string): YarpCluster
function withMatch
Sets the route match criteria.
withMatch(match: YarpRouteMatch): YarpRoute
function withMatchHeaders
Matches requests that contain the specified headers.
withMatchHeaders(headers: YarpRouteHeaderMatch[]): YarpRoute
function withMatchHosts
Matches requests that contain the specified host headers.
withMatchHosts(hosts: string[]): YarpRoute
function withMatchMethods
Matches requests that use the specified HTTP methods.
withMatchMethods(methods: string[]): YarpRoute
function withMatchPath
Matches requests with the specified path pattern.
withMatchPath(path: string): YarpRoute
function withMatchRouteQueryParameter
Matches requests that contain the specified query parameters.
withMatchRouteQueryParameter(queryParameters: YarpRouteQueryParameterMatch[]): YarpRoute
function withMaxRequestBodySize
Sets the maximum request body size for the route.
withMaxRequestBodySize(maxRequestBodySize: number): YarpRoute
function withMetadata
Sets metadata for the cluster.
withMetadata(metadata: Dict<string,string>): YarpCluster
function withMetadata
Sets metadata for the route.
withMetadata(metadata: Dict<string,string>): YarpRoute
function withOrder
Sets the route order.
withOrder(order: number): YarpRoute
function withSessionAffinityConfig
Sets the session affinity configuration for the cluster.
withSessionAffinityConfig(config: YarpSessionAffinityConfig): YarpCluster
function withStaticFiles builder
Enables static file serving in the YARP resource. Static files are served from the wwwroot folder.
withStaticFiles(): YarpResource
function withTransform
Adds a transform to the route.
withTransform(transform: Dict<string,string>): YarpRoute
function withTransformClientCertHeader
Adds the transform which will set the given header with the Base64 encoded client certificate.
withTransformClientCertHeader(headerName: string): YarpRoute
function withTransformCopyRequestHeaders
Adds the transform which will enable or suppress copying request headers to the proxy request.
withTransformCopyRequestHeaders(copy?: boolean): YarpRoute
function withTransformCopyResponseHeaders
Adds the transform which will enable or suppress copying response headers to the client response.
withTransformCopyResponseHeaders(copy?: boolean): YarpRoute
function withTransformCopyResponseTrailers
Adds the transform which will enable or suppress copying response trailers to the client response.
withTransformCopyResponseTrailers(copy?: boolean): YarpRoute
function withTransformForwarded
Adds the transform which will add the Forwarded header as defined by [RFC 7239](https://tools.ietf.org/html/rfc7239).
withTransformForwarded(useHost?: boolean, useProto?: boolean, forFormat?: NodeFormat, byFormat?: NodeFormat, action?: ForwardedTransformActions): YarpRoute
function withTransformHttpMethodChange
Adds the transform that will replace the HTTP method if it matches.
withTransformHttpMethodChange(fromHttpMethod: string, toHttpMethod: string): YarpRoute
function withTransformPathPrefix
Adds the transform which will prefix the request path with the given value.
withTransformPathPrefix(prefix: string): YarpRoute
function withTransformPathRemovePrefix
Adds the transform which will remove the matching prefix from the request path.
withTransformPathRemovePrefix(prefix: string): YarpRoute
function withTransformPathRouteValues
Adds the transform which will set the request path with route values.
withTransformPathRouteValues(pattern: string): YarpRoute
function withTransformPathSet
Adds the transform which sets the request path with the given value.
withTransformPathSet(path: string): YarpRoute
function withTransformQueryRemoveKey
Adds the transform that will remove the given query key.
withTransformQueryRemoveKey(queryKey: string): YarpRoute
function withTransformQueryRouteValue
Adds the transform that will append or set the query parameter from a route value.
withTransformQueryRouteValue(queryKey: string, routeValueKey: string, append?: boolean): YarpRoute
function withTransformQueryValue
Adds the transform that will append or set the query parameter from the given value.
withTransformQueryValue(queryKey: string, value: string, append?: boolean): YarpRoute
function withTransformRequestHeader
Adds the transform which will append or set the request header.
withTransformRequestHeader(headerName: string, value: string, append?: boolean): YarpRoute
function withTransformRequestHeaderRemove
Adds the transform which will remove the request header.
withTransformRequestHeaderRemove(headerName: string): YarpRoute
function withTransformRequestHeaderRouteValue
Adds the transform which will append or set the request header from a route value.
withTransformRequestHeaderRouteValue(headerName: string, routeValueKey: string, append?: boolean): YarpRoute
function withTransformRequestHeadersAllowed
Adds the transform which will only copy the allowed request headers. Other transforms
withTransformRequestHeadersAllowed(allowedHeaders: string[]): YarpRoute
function withTransformResponseHeader
Adds the transform which will append or set the response header.
withTransformResponseHeader(headerName: string, value: string, append?: boolean, condition?: ResponseCondition): YarpRoute
function withTransformResponseHeaderRemove
Adds the transform which will remove the response header.
withTransformResponseHeaderRemove(headerName: string, condition?: ResponseCondition): YarpRoute
function withTransformResponseHeadersAllowed
Adds the transform which will only copy the allowed response headers. Other transforms
withTransformResponseHeadersAllowed(allowedHeaders: string[]): YarpRoute
function withTransformResponseTrailer
Adds the transform which will append or set the response trailer.
withTransformResponseTrailer(headerName: string, value: string, append?: boolean, condition?: ResponseCondition): YarpRoute
function withTransformResponseTrailerRemove
Adds the transform which will remove the response trailer.
withTransformResponseTrailerRemove(headerName: string, condition?: ResponseCondition): YarpRoute
function withTransformResponseTrailersAllowed
Adds the transform which will only copy the allowed response trailers. Other transforms
withTransformResponseTrailersAllowed(allowedHeaders: string[]): YarpRoute
function withTransforms
Sets the transforms for the route.
withTransforms(transforms: Dict<string,string>[]): YarpRoute
function withTransformUseOriginalHostHeader
Adds the transform which will copy the incoming request Host header to the proxy request.
withTransformUseOriginalHostHeader(useOriginal?: boolean): YarpRoute
function withTransformXForwarded
Adds the transform which will add X-Forwarded-* headers.
withTransformXForwarded(headerPrefix?: string, xDefault?: ForwardedTransformActions, xFor?: ForwardedTransformActions, xHost?: ForwardedTransformActions, xProto?: ForwardedTransformActions, xPrefix?: ForwardedTransformActions): YarpRoute

Enums