# YarpRoute

- Module: [Aspire.Hosting.Yarp](/reference/api/go/aspire.hosting.yarp.md)
- Version: `17.0.0`
- Kind: `handle`
- Source: [GitHub](https://github.com/microsoft/aspire/tree/2d325b13709752ba6d9a943635c5e2940a2530c0)

Represents a route for YARP

## Definition

```go
type YarpRoute interface{}
```

## Methods

- [WithMatch](/reference/api/go/aspire.hosting.yarp/yarproute/withmatch.md) -- `method` -- Set the parameters used to match requests.
  ```go
  WithMatch(match *YarpRouteMatch) YarpRoute
  ```
- [WithMatchHeaders](/reference/api/go/aspire.hosting.yarp/yarproute/withmatchheaders.md) -- `method` -- Only match requests that contain all of these headers.
  ```go
  WithMatchHeaders(headers []*YarpRouteHeaderMatch) YarpRoute
  ```
- [WithMatchHosts](/reference/api/go/aspire.hosting.yarp/yarproute/withmatchhosts.md) -- `method` -- Only match requests with the given Host header. Supports wildcards and ports. For unicode host names, do not use punycode.
  ```go
  WithMatchHosts(hosts []string) YarpRoute
  ```
- [WithMatchMethods](/reference/api/go/aspire.hosting.yarp/yarproute/withmatchmethods.md) -- `method` -- Only match requests that use these optional HTTP methods. E.g. GET, POST.
  ```go
  WithMatchMethods(methods []string) YarpRoute
  ```
- [WithMatchPath](/reference/api/go/aspire.hosting.yarp/yarproute/withmatchpath.md) -- `method` -- Only match requests with the given Path pattern.
  ```go
  WithMatchPath(path string) YarpRoute
  ```
- [WithMatchRouteQueryParameter](/reference/api/go/aspire.hosting.yarp/yarproute/withmatchroutequeryparameter.md) -- `method` -- Only match requests that contain all of these query parameters.
  ```go
  WithMatchRouteQueryParameter(queryParameters []*YarpRouteQueryParameterMatch) YarpRoute
  ```
- [WithMaxRequestBodySize](/reference/api/go/aspire.hosting.yarp/yarproute/withmaxrequestbodysize.md) -- `method` -- Set the MaxRequestBodySize for the destination
  ```go
  WithMaxRequestBodySize(maxRequestBodySize float64) YarpRoute
  ```
- [WithMetadata](/reference/api/go/aspire.hosting.yarp/yarproute/withmetadata.md) -- `method` -- Set the Metadata of the destination
  ```go
  WithMetadata(metadata map[string]string) YarpRoute
  ```
- [WithOrder](/reference/api/go/aspire.hosting.yarp/yarproute/withorder.md) -- `method` -- Set the order for the destination
  ```go
  WithOrder(order *float64) YarpRoute
  ```
- [WithTransform](/reference/api/go/aspire.hosting.yarp/yarproute/withtransform.md) -- `method` -- Add a new transform to the destination.
  ```go
  WithTransform(transform map[string]string) YarpRoute
  ```
- [WithTransformClientCertHeader](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformclientcertheader.md) -- `method` -- Adds the transform which will set the given header with the Base64 encoded client certificate.
  ```go
  WithTransformClientCertHeader(headerName string) YarpRoute
  ```
- [WithTransformCopyRequestHeaders](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformcopyrequestheaders.md) -- `method` -- Adds the transform which will enable or suppress copying request headers to the proxy request.
  ```go
  WithTransformCopyRequestHeaders(options ...*WithTransformCopyRequestHeadersOptions) YarpRoute
  ```
- [WithTransformCopyResponseHeaders](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformcopyresponseheaders.md) -- `method` -- Adds the transform which will enable or suppress copying response headers to the client response.
  ```go
  WithTransformCopyResponseHeaders(options ...*WithTransformCopyResponseHeadersOptions) YarpRoute
  ```
- [WithTransformCopyResponseTrailers](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformcopyresponsetrailers.md) -- `method` -- Adds the transform which will enable or suppress copying response trailers to the client response.
  ```go
  WithTransformCopyResponseTrailers(options ...*WithTransformCopyResponseTrailersOptions) YarpRoute
  ```
- [WithTransformForwarded](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformforwarded.md) -- `method` -- Adds the transform which will add the Forwarded header as defined by [RFC 7239](https://tools.ietf.org/html/rfc7239).
  ```go
  WithTransformForwarded(options ...*WithTransformForwardedOptions) YarpRoute
  ```
- [WithTransformHttpMethodChange](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformhttpmethodchange.md) -- `method` -- Adds the transform that will replace the HTTP method if it matches.
  ```go
  WithTransformHttpMethodChange(fromHttpMethod string, toHttpMethod string) YarpRoute
  ```
- [WithTransformPathPrefix](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformpathprefix.md) -- `method` -- Adds the transform which will prefix the request path with the given value.
  ```go
  WithTransformPathPrefix(prefix string) YarpRoute
  ```
- [WithTransformPathRemovePrefix](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformpathremoveprefix.md) -- `method` -- Adds the transform which will remove the matching prefix from the request path.
  ```go
  WithTransformPathRemovePrefix(prefix string) YarpRoute
  ```
- [WithTransformPathRouteValues](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformpathroutevalues.md) -- `method` -- Adds the transform which will set the request path with route values.
  ```go
  WithTransformPathRouteValues(pattern string) YarpRoute
  ```
- [WithTransformPathSet](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformpathset.md) -- `method` -- Adds the transform which sets the request path with the given value.
  ```go
  WithTransformPathSet(path string) YarpRoute
  ```
- [WithTransformQueryRemoveKey](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformqueryremovekey.md) -- `method` -- Adds the transform that will remove the given query key.
  ```go
  WithTransformQueryRemoveKey(queryKey string) YarpRoute
  ```
- [WithTransformQueryRouteValue](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformqueryroutevalue.md) -- `method` -- Adds the transform that will append or set the query parameter from a route value.
  ```go
  WithTransformQueryRouteValue(queryKey string, routeValueKey string, options ...*WithTransformQueryRouteValueOptions) YarpRoute
  ```
- [WithTransformQueryValue](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformqueryvalue.md) -- `method` -- Adds the transform that will append or set the query parameter from the given value.
  ```go
  WithTransformQueryValue(queryKey string, value string, options ...*WithTransformQueryValueOptions) YarpRoute
  ```
- [WithTransformRequestHeader](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformrequestheader.md) -- `method` -- Adds the transform which will append or set the request header.
  ```go
  WithTransformRequestHeader(headerName string, value string, options ...*WithTransformRequestHeaderOptions) YarpRoute
  ```
- [WithTransformRequestHeaderRemove](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformrequestheaderremove.md) -- `method` -- Adds the transform which will remove the request header.
  ```go
  WithTransformRequestHeaderRemove(headerName string) YarpRoute
  ```
- [WithTransformRequestHeaderRouteValue](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformrequestheaderroutevalue.md) -- `method` -- Adds the transform which will append or set the request header from a route value.
  ```go
  WithTransformRequestHeaderRouteValue(headerName string, routeValueKey string, options ...*WithTransformRequestHeaderRouteValueOptions) YarpRoute
  ```
- [WithTransformRequestHeadersAllowed](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformrequestheadersallowed.md) -- `method` -- 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.
  ```go
  WithTransformRequestHeadersAllowed(allowedHeaders []string) YarpRoute
  ```
- [WithTransformResponseHeader](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformresponseheader.md) -- `method` -- Adds the transform which will append or set the response header.
  ```go
  WithTransformResponseHeader(headerName string, value string, options ...*WithTransformResponseHeaderOptions) YarpRoute
  ```
- [WithTransformResponseHeaderRemove](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformresponseheaderremove.md) -- `method` -- Adds the transform which will remove the response header.
  ```go
  WithTransformResponseHeaderRemove(headerName string, options ...*WithTransformResponseHeaderRemoveOptions) YarpRoute
  ```
- [WithTransformResponseHeadersAllowed](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformresponseheadersallowed.md) -- `method` -- Adds the transform which will only copy the allowed response headers. Other transforms that modify or append to existing headers may be affected if not included in the allow list.
  ```go
  WithTransformResponseHeadersAllowed(allowedHeaders []string) YarpRoute
  ```
- [WithTransformResponseTrailer](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformresponsetrailer.md) -- `method` -- Adds the transform which will append or set the response trailer.
  ```go
  WithTransformResponseTrailer(headerName string, value string, options ...*WithTransformResponseTrailerOptions) YarpRoute
  ```
- [WithTransformResponseTrailerRemove](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformresponsetrailerremove.md) -- `method` -- Adds the transform which will remove the response trailer.
  ```go
  WithTransformResponseTrailerRemove(headerName string, options ...*WithTransformResponseTrailerRemoveOptions) YarpRoute
  ```
- [WithTransformResponseTrailersAllowed](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformresponsetrailersallowed.md) -- `method` -- Adds the transform which will only copy the allowed response trailers. Other transforms that modify or append to existing trailers may be affected if not included in the allow list.
  ```go
  WithTransformResponseTrailersAllowed(allowedHeaders []string) YarpRoute
  ```
- [WithTransforms](/reference/api/go/aspire.hosting.yarp/yarproute/withtransforms.md) -- `method` -- Set the Transforms of the destination
  ```go
  WithTransforms(transforms []map[string]string) YarpRoute
  ```
- [WithTransformUseOriginalHostHeader](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformuseoriginalhostheader.md) -- `method` -- Adds the transform which will copy the incoming request Host header to the proxy request.
  ```go
  WithTransformUseOriginalHostHeader(options ...*WithTransformUseOriginalHostHeaderOptions) YarpRoute
  ```
- [WithTransformXForwarded](/reference/api/go/aspire.hosting.yarp/yarproute/withtransformxforwarded.md) -- `method` -- Adds the transform which will add X-Forwarded-* headers.
  ```go
  WithTransformXForwarded(options ...*WithTransformXForwardedOptions) YarpRoute
  ```
