Configure Azure Container App HTTP Route Rules

The azure-native:app:HttpRouteConfig resource, part of the Pulumi Azure Native provider, defines advanced ingress routing rules for Container App Environments: path matching, URL rewriting, and traffic distribution. This guide focuses on three capabilities: path-based routing with three matching strategies, URL prefix rewriting, and custom domain binding with TLS.

Route configs belong to Container App Environments and reference existing container apps, revisions, labels, and certificates. The examples are intentionally small. Combine them with your own Container App Environment and app deployments.

Route traffic with path matching and prefix rewriting

Container App Environments route incoming requests to specific apps based on URL paths, often rewriting paths to maintain clean internal APIs.

import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const httpRouteConfig = new azure_native.app.HttpRouteConfig("httpRouteConfig", {
    environmentName: "testcontainerenv",
    httpRouteName: "httproutefriendlyname",
    properties: {
        customDomains: [{
            bindingType: azure_native.app.BindingType.SniEnabled,
            certificateId: "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1",
            name: "example.com",
        }],
        rules: [{
            description: "random-description",
            routes: [{
                action: {
                    prefixRewrite: "/v1/api",
                },
                match: {
                    caseSensitive: true,
                    path: "/v1",
                },
            }],
            targets: [{
                containerApp: "capp-1",
                revision: "rev-1",
                weight: 100,
            }],
        }],
    },
    resourceGroupName: "examplerg",
});
import pulumi
import pulumi_azure_native as azure_native

http_route_config = azure_native.app.HttpRouteConfig("httpRouteConfig",
    environment_name="testcontainerenv",
    http_route_name="httproutefriendlyname",
    properties={
        "custom_domains": [{
            "binding_type": azure_native.app.BindingType.SNI_ENABLED,
            "certificate_id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1",
            "name": "example.com",
        }],
        "rules": [{
            "description": "random-description",
            "routes": [{
                "action": {
                    "prefix_rewrite": "/v1/api",
                },
                "match": {
                    "case_sensitive": True,
                    "path": "/v1",
                },
            }],
            "targets": [{
                "container_app": "capp-1",
                "revision": "rev-1",
                "weight": 100,
            }],
        }],
    },
    resource_group_name="examplerg")
package main

import (
	app "github.com/pulumi/pulumi-azure-native-sdk/app/v3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := app.NewHttpRouteConfig(ctx, "httpRouteConfig", &app.HttpRouteConfigArgs{
			EnvironmentName: pulumi.String("testcontainerenv"),
			HttpRouteName:   pulumi.String("httproutefriendlyname"),
			Properties: &app.HttpRouteConfigPropertiesArgs{
				CustomDomains: app.CustomDomainArray{
					&app.CustomDomainArgs{
						BindingType:   pulumi.String(app.BindingTypeSniEnabled),
						CertificateId: pulumi.String("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1"),
						Name:          pulumi.String("example.com"),
					},
				},
				Rules: app.HttpRouteRuleArray{
					&app.HttpRouteRuleArgs{
						Description: pulumi.String("random-description"),
						Routes: app.HttpRouteArray{
							&app.HttpRouteArgs{
								Action: &app.HttpRouteActionArgs{
									PrefixRewrite: pulumi.String("/v1/api"),
								},
								Match: &app.HttpRouteMatchArgs{
									CaseSensitive: pulumi.Bool(true),
									Path:          pulumi.String("/v1"),
								},
							},
						},
						Targets: app.HttpRouteTargetArray{
							&app.HttpRouteTargetArgs{
								ContainerApp: pulumi.String("capp-1"),
								Revision:     pulumi.String("rev-1"),
								Weight:       pulumi.Int(100),
							},
						},
					},
				},
			},
			ResourceGroupName: pulumi.String("examplerg"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;

return await Deployment.RunAsync(() => 
{
    var httpRouteConfig = new AzureNative.App.HttpRouteConfig("httpRouteConfig", new()
    {
        EnvironmentName = "testcontainerenv",
        HttpRouteName = "httproutefriendlyname",
        Properties = new AzureNative.App.Inputs.HttpRouteConfigPropertiesArgs
        {
            CustomDomains = new[]
            {
                new AzureNative.App.Inputs.CustomDomainArgs
                {
                    BindingType = AzureNative.App.BindingType.SniEnabled,
                    CertificateId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1",
                    Name = "example.com",
                },
            },
            Rules = new[]
            {
                new AzureNative.App.Inputs.HttpRouteRuleArgs
                {
                    Description = "random-description",
                    Routes = new[]
                    {
                        new AzureNative.App.Inputs.HttpRouteArgs
                        {
                            Action = new AzureNative.App.Inputs.HttpRouteActionArgs
                            {
                                PrefixRewrite = "/v1/api",
                            },
                            Match = new AzureNative.App.Inputs.HttpRouteMatchArgs
                            {
                                CaseSensitive = true,
                                Path = "/v1",
                            },
                        },
                    },
                    Targets = new[]
                    {
                        new AzureNative.App.Inputs.HttpRouteTargetArgs
                        {
                            ContainerApp = "capp-1",
                            Revision = "rev-1",
                            Weight = 100,
                        },
                    },
                },
            },
        },
        ResourceGroupName = "examplerg",
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.app.HttpRouteConfig;
import com.pulumi.azurenative.app.HttpRouteConfigArgs;
import com.pulumi.azurenative.app.inputs.HttpRouteConfigPropertiesArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var httpRouteConfig = new HttpRouteConfig("httpRouteConfig", HttpRouteConfigArgs.builder()
            .environmentName("testcontainerenv")
            .httpRouteName("httproutefriendlyname")
            .properties(HttpRouteConfigPropertiesArgs.builder()
                .customDomains(CustomDomainArgs.builder()
                    .bindingType("SniEnabled")
                    .certificateId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1")
                    .name("example.com")
                    .build())
                .rules(HttpRouteRuleArgs.builder()
                    .description("random-description")
                    .routes(HttpRouteArgs.builder()
                        .action(HttpRouteActionArgs.builder()
                            .prefixRewrite("/v1/api")
                            .build())
                        .match(HttpRouteMatchArgs.builder()
                            .caseSensitive(true)
                            .path("/v1")
                            .build())
                        .build())
                    .targets(HttpRouteTargetArgs.builder()
                        .containerApp("capp-1")
                        .revision("rev-1")
                        .weight(100)
                        .build())
                    .build())
                .build())
            .resourceGroupName("examplerg")
            .build());

    }
}
resources:
  httpRouteConfig:
    type: azure-native:app:HttpRouteConfig
    properties:
      environmentName: testcontainerenv
      httpRouteName: httproutefriendlyname
      properties:
        customDomains:
          - bindingType: SniEnabled
            certificateId: /subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1
            name: example.com
        rules:
          - description: random-description
            routes:
              - action:
                  prefixRewrite: /v1/api
                match:
                  caseSensitive: true
                  path: /v1
            targets:
              - containerApp: capp-1
                revision: rev-1
                weight: 100
      resourceGroupName: examplerg

When a request arrives, the match condition checks if the path equals “/v1” (case-sensitive). If matched, the action rewrites the prefix to “/v1/api” before forwarding to the target. The targets array specifies which container app and revision receive traffic, with weight controlling distribution across multiple targets. The customDomains array binds a custom domain with SNI-enabled TLS using a certificate from the environment.

Route with path-separated prefix matching

Path-separated prefix matching treats path segments as distinct units, ensuring /v1/users matches /v1 but /v1users does not.

import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const httpRouteConfig = new azure_native.app.HttpRouteConfig("httpRouteConfig", {
    environmentName: "testcontainerenv",
    httpRouteName: "httproutefriendlyname",
    properties: {
        customDomains: [{
            bindingType: azure_native.app.BindingType.Disabled,
            certificateId: "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1",
            name: "example.com",
        }],
        rules: [{
            description: "random-description",
            routes: [{
                action: {
                    prefixRewrite: "/v1/api",
                },
                match: {
                    caseSensitive: true,
                    pathSeparatedPrefix: "/v1",
                },
            }],
            targets: [{
                containerApp: "capp-1",
                label: "label-1",
            }],
        }],
    },
    resourceGroupName: "examplerg",
});
import pulumi
import pulumi_azure_native as azure_native

http_route_config = azure_native.app.HttpRouteConfig("httpRouteConfig",
    environment_name="testcontainerenv",
    http_route_name="httproutefriendlyname",
    properties={
        "custom_domains": [{
            "binding_type": azure_native.app.BindingType.DISABLED,
            "certificate_id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1",
            "name": "example.com",
        }],
        "rules": [{
            "description": "random-description",
            "routes": [{
                "action": {
                    "prefix_rewrite": "/v1/api",
                },
                "match": {
                    "case_sensitive": True,
                    "path_separated_prefix": "/v1",
                },
            }],
            "targets": [{
                "container_app": "capp-1",
                "label": "label-1",
            }],
        }],
    },
    resource_group_name="examplerg")
package main

import (
	app "github.com/pulumi/pulumi-azure-native-sdk/app/v3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := app.NewHttpRouteConfig(ctx, "httpRouteConfig", &app.HttpRouteConfigArgs{
			EnvironmentName: pulumi.String("testcontainerenv"),
			HttpRouteName:   pulumi.String("httproutefriendlyname"),
			Properties: &app.HttpRouteConfigPropertiesArgs{
				CustomDomains: app.CustomDomainArray{
					&app.CustomDomainArgs{
						BindingType:   pulumi.String(app.BindingTypeDisabled),
						CertificateId: pulumi.String("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1"),
						Name:          pulumi.String("example.com"),
					},
				},
				Rules: app.HttpRouteRuleArray{
					&app.HttpRouteRuleArgs{
						Description: pulumi.String("random-description"),
						Routes: app.HttpRouteArray{
							&app.HttpRouteArgs{
								Action: &app.HttpRouteActionArgs{
									PrefixRewrite: pulumi.String("/v1/api"),
								},
								Match: &app.HttpRouteMatchArgs{
									CaseSensitive:       pulumi.Bool(true),
									PathSeparatedPrefix: pulumi.String("/v1"),
								},
							},
						},
						Targets: app.HttpRouteTargetArray{
							&app.HttpRouteTargetArgs{
								ContainerApp: pulumi.String("capp-1"),
								Label:        pulumi.String("label-1"),
							},
						},
					},
				},
			},
			ResourceGroupName: pulumi.String("examplerg"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;

return await Deployment.RunAsync(() => 
{
    var httpRouteConfig = new AzureNative.App.HttpRouteConfig("httpRouteConfig", new()
    {
        EnvironmentName = "testcontainerenv",
        HttpRouteName = "httproutefriendlyname",
        Properties = new AzureNative.App.Inputs.HttpRouteConfigPropertiesArgs
        {
            CustomDomains = new[]
            {
                new AzureNative.App.Inputs.CustomDomainArgs
                {
                    BindingType = AzureNative.App.BindingType.Disabled,
                    CertificateId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1",
                    Name = "example.com",
                },
            },
            Rules = new[]
            {
                new AzureNative.App.Inputs.HttpRouteRuleArgs
                {
                    Description = "random-description",
                    Routes = new[]
                    {
                        new AzureNative.App.Inputs.HttpRouteArgs
                        {
                            Action = new AzureNative.App.Inputs.HttpRouteActionArgs
                            {
                                PrefixRewrite = "/v1/api",
                            },
                            Match = new AzureNative.App.Inputs.HttpRouteMatchArgs
                            {
                                CaseSensitive = true,
                                PathSeparatedPrefix = "/v1",
                            },
                        },
                    },
                    Targets = new[]
                    {
                        new AzureNative.App.Inputs.HttpRouteTargetArgs
                        {
                            ContainerApp = "capp-1",
                            Label = "label-1",
                        },
                    },
                },
            },
        },
        ResourceGroupName = "examplerg",
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.app.HttpRouteConfig;
import com.pulumi.azurenative.app.HttpRouteConfigArgs;
import com.pulumi.azurenative.app.inputs.HttpRouteConfigPropertiesArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var httpRouteConfig = new HttpRouteConfig("httpRouteConfig", HttpRouteConfigArgs.builder()
            .environmentName("testcontainerenv")
            .httpRouteName("httproutefriendlyname")
            .properties(HttpRouteConfigPropertiesArgs.builder()
                .customDomains(CustomDomainArgs.builder()
                    .bindingType("Disabled")
                    .certificateId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1")
                    .name("example.com")
                    .build())
                .rules(HttpRouteRuleArgs.builder()
                    .description("random-description")
                    .routes(HttpRouteArgs.builder()
                        .action(HttpRouteActionArgs.builder()
                            .prefixRewrite("/v1/api")
                            .build())
                        .match(HttpRouteMatchArgs.builder()
                            .caseSensitive(true)
                            .pathSeparatedPrefix("/v1")
                            .build())
                        .build())
                    .targets(HttpRouteTargetArgs.builder()
                        .containerApp("capp-1")
                        .label("label-1")
                        .build())
                    .build())
                .build())
            .resourceGroupName("examplerg")
            .build());

    }
}
resources:
  httpRouteConfig:
    type: azure-native:app:HttpRouteConfig
    properties:
      environmentName: testcontainerenv
      httpRouteName: httproutefriendlyname
      properties:
        customDomains:
          - bindingType: Disabled
            certificateId: /subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1
            name: example.com
        rules:
          - description: random-description
            routes:
              - action:
                  prefixRewrite: /v1/api
                match:
                  caseSensitive: true
                  pathSeparatedPrefix: /v1
            targets:
              - containerApp: capp-1
                label: label-1
      resourceGroupName: examplerg

The pathSeparatedPrefix property matches path segments rather than raw strings. This prevents partial matches: “/v1” matches “/v1/api” but not “/v1api”. The targets array uses label instead of revision, routing to all revisions tagged with that label. The bindingType is set to Disabled, meaning the custom domain uses HTTP only without TLS termination.

Route with simple prefix matching

Simple prefix matching routes any request starting with the specified string, providing the most flexible path-based routing option.

import * as pulumi from "@pulumi/pulumi";
import * as azure_native from "@pulumi/azure-native";

const httpRouteConfig = new azure_native.app.HttpRouteConfig("httpRouteConfig", {
    environmentName: "testcontainerenv",
    httpRouteName: "httproutefriendlyname",
    properties: {
        customDomains: [{
            bindingType: azure_native.app.BindingType.Disabled,
            certificateId: "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1",
            name: "example.com",
        }],
        rules: [{
            description: "random-description",
            routes: [{
                action: {
                    prefixRewrite: "/v1/api",
                },
                match: {
                    caseSensitive: true,
                    prefix: "/v1",
                },
            }],
            targets: [{
                containerApp: "capp-1",
                label: "label-1",
            }],
        }],
    },
    resourceGroupName: "examplerg",
});
import pulumi
import pulumi_azure_native as azure_native

http_route_config = azure_native.app.HttpRouteConfig("httpRouteConfig",
    environment_name="testcontainerenv",
    http_route_name="httproutefriendlyname",
    properties={
        "custom_domains": [{
            "binding_type": azure_native.app.BindingType.DISABLED,
            "certificate_id": "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1",
            "name": "example.com",
        }],
        "rules": [{
            "description": "random-description",
            "routes": [{
                "action": {
                    "prefix_rewrite": "/v1/api",
                },
                "match": {
                    "case_sensitive": True,
                    "prefix": "/v1",
                },
            }],
            "targets": [{
                "container_app": "capp-1",
                "label": "label-1",
            }],
        }],
    },
    resource_group_name="examplerg")
package main

import (
	app "github.com/pulumi/pulumi-azure-native-sdk/app/v3"
	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)

func main() {
	pulumi.Run(func(ctx *pulumi.Context) error {
		_, err := app.NewHttpRouteConfig(ctx, "httpRouteConfig", &app.HttpRouteConfigArgs{
			EnvironmentName: pulumi.String("testcontainerenv"),
			HttpRouteName:   pulumi.String("httproutefriendlyname"),
			Properties: &app.HttpRouteConfigPropertiesArgs{
				CustomDomains: app.CustomDomainArray{
					&app.CustomDomainArgs{
						BindingType:   pulumi.String(app.BindingTypeDisabled),
						CertificateId: pulumi.String("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1"),
						Name:          pulumi.String("example.com"),
					},
				},
				Rules: app.HttpRouteRuleArray{
					&app.HttpRouteRuleArgs{
						Description: pulumi.String("random-description"),
						Routes: app.HttpRouteArray{
							&app.HttpRouteArgs{
								Action: &app.HttpRouteActionArgs{
									PrefixRewrite: pulumi.String("/v1/api"),
								},
								Match: &app.HttpRouteMatchArgs{
									CaseSensitive: pulumi.Bool(true),
									Prefix:        pulumi.String("/v1"),
								},
							},
						},
						Targets: app.HttpRouteTargetArray{
							&app.HttpRouteTargetArgs{
								ContainerApp: pulumi.String("capp-1"),
								Label:        pulumi.String("label-1"),
							},
						},
					},
				},
			},
			ResourceGroupName: pulumi.String("examplerg"),
		})
		if err != nil {
			return err
		}
		return nil
	})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using AzureNative = Pulumi.AzureNative;

return await Deployment.RunAsync(() => 
{
    var httpRouteConfig = new AzureNative.App.HttpRouteConfig("httpRouteConfig", new()
    {
        EnvironmentName = "testcontainerenv",
        HttpRouteName = "httproutefriendlyname",
        Properties = new AzureNative.App.Inputs.HttpRouteConfigPropertiesArgs
        {
            CustomDomains = new[]
            {
                new AzureNative.App.Inputs.CustomDomainArgs
                {
                    BindingType = AzureNative.App.BindingType.Disabled,
                    CertificateId = "/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1",
                    Name = "example.com",
                },
            },
            Rules = new[]
            {
                new AzureNative.App.Inputs.HttpRouteRuleArgs
                {
                    Description = "random-description",
                    Routes = new[]
                    {
                        new AzureNative.App.Inputs.HttpRouteArgs
                        {
                            Action = new AzureNative.App.Inputs.HttpRouteActionArgs
                            {
                                PrefixRewrite = "/v1/api",
                            },
                            Match = new AzureNative.App.Inputs.HttpRouteMatchArgs
                            {
                                CaseSensitive = true,
                                Prefix = "/v1",
                            },
                        },
                    },
                    Targets = new[]
                    {
                        new AzureNative.App.Inputs.HttpRouteTargetArgs
                        {
                            ContainerApp = "capp-1",
                            Label = "label-1",
                        },
                    },
                },
            },
        },
        ResourceGroupName = "examplerg",
    });

});
package generated_program;

import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.azurenative.app.HttpRouteConfig;
import com.pulumi.azurenative.app.HttpRouteConfigArgs;
import com.pulumi.azurenative.app.inputs.HttpRouteConfigPropertiesArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;

public class App {
    public static void main(String[] args) {
        Pulumi.run(App::stack);
    }

    public static void stack(Context ctx) {
        var httpRouteConfig = new HttpRouteConfig("httpRouteConfig", HttpRouteConfigArgs.builder()
            .environmentName("testcontainerenv")
            .httpRouteName("httproutefriendlyname")
            .properties(HttpRouteConfigPropertiesArgs.builder()
                .customDomains(CustomDomainArgs.builder()
                    .bindingType("Disabled")
                    .certificateId("/subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1")
                    .name("example.com")
                    .build())
                .rules(HttpRouteRuleArgs.builder()
                    .description("random-description")
                    .routes(HttpRouteArgs.builder()
                        .action(HttpRouteActionArgs.builder()
                            .prefixRewrite("/v1/api")
                            .build())
                        .match(HttpRouteMatchArgs.builder()
                            .caseSensitive(true)
                            .prefix("/v1")
                            .build())
                        .build())
                    .targets(HttpRouteTargetArgs.builder()
                        .containerApp("capp-1")
                        .label("label-1")
                        .build())
                    .build())
                .build())
            .resourceGroupName("examplerg")
            .build());

    }
}
resources:
  httpRouteConfig:
    type: azure-native:app:HttpRouteConfig
    properties:
      environmentName: testcontainerenv
      httpRouteName: httproutefriendlyname
      properties:
        customDomains:
          - bindingType: Disabled
            certificateId: /subscriptions/34adfa4f-cedf-4dc0-ba29-b6d1a69ab345/resourceGroups/examplerg/providers/Microsoft.App/managedEnvironments/testcontainerenv/certificates/certificate-1
            name: example.com
        rules:
          - description: random-description
            routes:
              - action:
                  prefixRewrite: /v1/api
                match:
                  caseSensitive: true
                  prefix: /v1
            targets:
              - containerApp: capp-1
                label: label-1
      resourceGroupName: examplerg

The prefix property matches any path beginning with “/v1”, including “/v1”, “/v1/”, “/v1api”, and “/v1/users/123”. This broader matching strategy works well for routing entire API namespaces to a single container app. Like the previous example, this uses label-based targeting and disabled TLS binding.

Beyond these examples

These snippets focus on specific route config features: path-based routing (exact, prefix, and segment-aware matching), URL rewriting and custom domain binding, and traffic targeting (revisions, labels, and weights). They’re intentionally minimal rather than full ingress configurations.

The examples reference pre-existing infrastructure such as Container App Environments, container apps with revisions or labels, and TLS certificates for custom domains. They focus on configuring the route rather than provisioning the underlying environment.

To keep things focused, common routing patterns are omitted, including:

  • Header-based routing and matching
  • Traffic splitting across multiple targets
  • Query parameter matching
  • HTTP method filtering

These omissions are intentional: the goal is to illustrate how each routing feature is wired, not provide drop-in ingress modules. See the HttpRouteConfig resource reference for all available configuration options.

Let's configure Azure Container App HTTP Route Rules

Get started with Pulumi Cloud, then follow our quick setup guide to deploy this infrastructure.

Try Pulumi Cloud for FREE

Frequently Asked Questions

Resource Configuration & Immutability
What properties can't I change after creating an HTTP route config?
The environmentName, httpRouteName, and resourceGroupName properties are immutable and require resource replacement if changed.
Which Azure API version does this resource use?
The resource uses Azure REST API version 2025-02-02-preview by default. In version 2.x of the Azure Native provider, it used 2024-10-02-preview. Other available versions include 2024-10-02-preview, 2025-07-01, and 2025-10-02-preview.
Routing & Path Matching
What's the difference between path, pathSeparatedPrefix, and prefix matching?
The match property supports three path matching options: path, pathSeparatedPrefix, and prefix. Each example demonstrates a different matching type, though the schema doesn’t detail their behavioral differences.
How do I rewrite URL paths when routing traffic?
Use the prefixRewrite property within action to rewrite the URL path prefix. For example, setting prefixRewrite: "/v1/api" rewrites the matched path to /v1/api.
Can I use case-insensitive path matching?
Yes, set caseSensitive: false in the match property. The examples show caseSensitive: true, but you can disable it for case-insensitive matching.
Traffic Targeting
How do I route traffic to a specific Container App revision?
Configure targets with containerApp, revision, and weight properties. For example, revision: "rev-1" with weight: 100 routes all traffic to that revision.
How do I route traffic using labels instead of revisions?
Configure targets with containerApp and label properties. For example, label: "label-1" routes traffic to the labeled revision.
Custom Domains & TLS
What binding types are available for custom domains?
Custom domains support two binding types: SniEnabled for SNI-based TLS binding, or Disabled for no TLS binding. Both require a certificateId reference.

Using a different cloud?

Explore networking guides for other cloud providers: