Radius.Compute/routes@2025-08-01-preview

Description

The Radius.Compute/routes Resource Type defines network routes for responding to external clients. Note that a Routes resource is not required for service-to-service communication. To use Routes, define a Container and ensure a containerPort is specified.

extension radius
param environment string

resource myApplication 'Radius.Core/applications@2025-08-01-preview' = { ... }

resource myContainer 'Radius.Compute/containers@2025-08-01-preview' = {
  name: 'myContainer'
  properties: {
    environment: environment
    application: myApplication.id
    containers: {
      frontend: {
        image: 'frontend:1.25'
        ports: {
          web: {
            containerPort: 8080
          }
        }
      }
      accounts: {
        image: 'accounts:1.25'
        ports: {
          web: {
            containerPort: 8080
          }
        }
      }
    }
  }
}

Then define a Routes resource.

resource ingressRule 'Radius.Compute/routes@2025-08-01-preview' = {
  name: 'ingressRule'
  properties: {
    application: myApplication.id
    environment: environment
    kind: 'HTTP'
    rules: [
      {
        matches: [
          {
            httpPath: '/'
          }
        ]
        destinationContainer: {
          resourceId: myContainer.id
          containerName: 'frontend'
          containerPort: myContainer.properties.containers.frontend.ports.web.containerPort
        }
      }
    ]
  }
}

The hostname is determined by the Recipe.

Multiple rules can be included in Routes.

resource ingressRule 'Radius.Compute/routes@2025-08-01-preview' = {
  name: 'ingressRule'
  properties: {
    application: myApplication.id
    environment: environment
    kind: 'HTTP'
    rules: [
      {
        matches: [
          {
            httpPath: '/'
          }
        ]
        destinationContainer: {
          resourceId: myContainer.id
          containerName: 'frontend'
          containerPort: myContainer.properties.containers.frontend.ports.web.containerPort
        }
      }
      {
        matches: [
          {
            httpPath: '/accounts'
          }
        ]
        destinationContainer: {
          resourceId: myContainer.id
          containerName: 'accounts'
          containerPort: myContainer.properties.containers.accounts.ports.web.containerPort
        }
      }
    ]
  }
}

Top-Level Properties

PropertyTypeDescription
applicationstring(Required) The Radius Application ID. myApplication.id for example.
codeReferencestringOptional URI to the source code of this resource type. ex: https://github.com/radius-project/radius/blob/4fab87e8127adf1db6f43b7029d5235fbe82c5c9/cmd/controller/main.go#L27
connectionsobjectMap of connection name to connection data.
environmentstring(Required) The Radius Environment ID. Typically set by the rad CLI. Typically value should be environment.
hostnamesstring array(Optional) Use only when kind is HTTP or TLS. When HTTP, match against the HTTP Host header. When using TLS, match against the SNI attribute of TLS ClientHello message. Hostname may be preceded by a * wildcard.
kindstring(Optional) The type of rule. If not specified, HTTPRoute is assumed. HTTPRoute provides L7 ingress with support for matching based on the hostname and HTTP header. TCPRoute provides L4 ingress with no support for matching (all traffic is forwarded to the Container). TLSRoute provides L4 ingress with the ability to match based on Server Name Indication (SNI) which is equivalent to hostname in TLS. UDPRoute is similar to TCPRoutes but uses UDP.
Allowed values: HTTP, TCP, TLS, UDP.
listenerobject(Read Only) The Gateway Listener the route is assigned to.
rulesobject[](Required) Rules define semantics for matching a network connection request based on conditions and forwarding the request to a Container.

Object Properties

connections

PropertyTypeDescription
disableDefaultEnvVarsbooleanDisables the automatic injection of environment variables from the connected resource’s properties.
sourcestringResource ID of the source resource for this connection.

listener

PropertyTypeDescription
hostnamestring
portinteger
protocolstringAllowed values: HTTP, HTTPS, TCP, TLS, UDP.

rules

PropertyTypeDescription
destinationContainerobject
matchesobject[](Required) Matches define conditions used for matching a request.

rules.destinationContainer

PropertyTypeDescription
containerNamestring(Required) The specific container to target within the Container resource.
containerPortinteger(Required) The port to target from the container.
resourceIdstring(Required) The Radius Container resource ID.

rules.matches

PropertyTypeDescription
httpHeadersobject[](Optional) HTTP headers to match. Specify only when kind is HTTP. Multiple match values are ANDed together. A request must match all the specified headers to match.
httpMethodstring(Optional) The HTTP method to match. Specify only when kind is HTTP.
Allowed values: CONNECT, DELETE, GET, HEAD, OPTIONS, PATCH, POST, PUT, TRACE.
httpPathstring(Optional) The HTTP request path to match. Trailing space is ignored. Requests for /abc, /abc/, and ``/abc/def/will all match/abc`.
httpQueryParamsobject[](Optional) HTTP query parameters to match. Specify only when kind is HTTP.

rules.matches.httpHeaders

PropertyTypeDescription
namestring(Required) The name of the HTTP Header to be matched. Must be exact.
valuestring(Required) Value of HTTP Header to be matched.

rules.matches.httpQueryParams

PropertyTypeDescription
namestring(Required) Name of the HTTP query parameter to be matched. Specify only when kind is HTTP.
valuestring(Required) Value of the HTTP query parameter to be matched.