---
title: Configuring routing rules
summary: null
url: >-
  https://www.fastly.com/documentation/guides/getting-started/domains/working-with-domains/configuring-routing-rules
---

The Fastly request routing feature lets you configure rules that route requests to different services based on specific application logic. This lets you break up domain paths and route them to different services within Fastly without needing to write code in Compute or VCL.

## How request routing works

In order to route requests, you create a routing configuration that consists of a _path_ and _rules_. The _path_ is the domain path you want to route requests from. The _rules_ are the criteria that must be met by those incoming requests to route them to the service you specify. 

For example, let's say you have a taco restaurant with the domain `www.tacolabs.com`. For the restaurant's anniversary, you plan on promoting exclusive deals to iPhone customers. You want to be able to route requests to the path `www.tacolabs.com/fiesta` coming from iPhone users to a specific service. To do this, you:

1. Create a new routing configuration called **Anniversary Fiesta**. 
2. Identify the path you want to match as `/fiesta`.
3. Define a rule that says **IF** the `User-Agent` header starts with `Mozilla/5.0 (iPhone; CPU iPhone)`, route traffic to the **Anniversary Fiesta** service. 
4. Define a default rule that routes all other traffic to your regular **Taco Labs** service.
5. Deploy the routing configuration.
6. Link the routing configuration to the `tacolabs.com` domain. 

Now, Fastly will automatically route requests to the proper service based on the `User-Agent` header. When the promotion is over, you simply unlink the routing configuration from the domain. 

## Limitations and considerations

When working with routing rules, keep in mind the following: 

- To create a routing configuration on a domain path, the domain must be configured in [Domain Management](https://www.fastly.com/documentation/guides/getting-started/domains/working-with-domains/working-with-domains/#about-the-domain-management-page), have a valid TLS certificate, and point to an active service.
- When creating a routing configuration, you must specify a default routing rule which applies to requests when no other rule conditions are met or configured.
- Each path is limited to 20 rules, and each rule can contain up to 5 specific conditions.

## Creating a routing configuration

To create a routing configuration, complete the following:

1.   Log in to the [Fastly control panel](https://manage.fastly.com).

2. Go to **Domains** > [**Routing configuration**](https://manage.fastly.com/routing/configurations). 

3. Click **Create configuration**.

4. Complete the following fields to define basic information for the configuration, including the domain path you want to act on:

   - In the **Configuration name** field, enter a name for the configuration.
   - In the **Comment** field, enter a comment that describes the changes made in the configuration.
   - In the **Path value** field, enter the path that you want to route requests from.

5. _(Optional)_ In the **Rule** section, define the rules that you want to apply to matching requests:

   - In the **Header** field, enter a header.
   - From the **Operator** menu, select an operator to specify how the selected header and value should be compared.
   - In the **Value** field, enter a value for the specified header.
   - _(Optional)_ Click **Add condition** to add another condition.
   - In the **Select service** field, select a service. Requests with data matching your conditions will be routed to this service.

6. _(Optional)_ Click **Add rule** to add another rule.

7. In the **Default Rule** section, select a service. Requests to the given path that don't match any of the other rule conditions will be routed to this service by default.

8. Click **Save**.

9. When you're ready, [deploy the routing configuration](https://www.fastly.com/documentation/guides/getting-started/domains/working-with-domains/configuring-routing-rules#deploying-a-routing-configuration) and [link the routing configuration to a domain](https://www.fastly.com/documentation/guides/getting-started/domains/working-with-domains/configuring-routing-rules#linking-a-routing-configuration-to-a-domain). 

## Deploying a routing configuration

When you're ready to apply your routing configuration to live traffic, deploy the routing configuration. Once a routing configuration is deployed and [linked to a domain](https://www.fastly.com/documentation/guides/getting-started/domains/working-with-domains/configuring-routing-rules#linking-a-routing-configuration-to-a-domain), incoming requests will be routed based on your rules. 

1.   Log in to the [Fastly control panel](https://manage.fastly.com).

2. Go to **Domains** > [**Routing configuration**](https://manage.fastly.com/routing/configurations). 
3. Click the name of the routing configuration you want to deploy.
4. Click **Deploy changes**. 
5. _(Optional)_ Click **View diff** to review the changes made to the configuration.
6. _(Optional)_ In the **Deployment comment** field, enter a comment that describes the changes being deployed. This can make it easier to identify the changes if you need to roll back later.
7. Click **Deploy changes**.

> **IMPORTANT:** You must [link the routing configuration to a domain](https://www.fastly.com/documentation/guides/getting-started/domains/working-with-domains/configuring-routing-rules#linking-a-routing-configuration-to-a-domain) to complete the process of routing live traffic. 

## Linking a routing configuration to a domain

By linking a routing configuration to a domain, you set up the process of routing live traffic. If the routing configuration has been deployed, traffic will be routed as soon as you link the domain.

To link a routing configuration to a domain:

1.   Log in to the [Fastly control panel](https://manage.fastly.com) and select [**Domains**](https://manage.fastly.com/domains) from the navigation sidebar.

2. Click the name of the domain you want to apply the configuration to. 
3. From the **Domain details** page, click the **Routing** tab.
4. From the **Link existing configuration** field, use the menu to select your routing configuration. Alternately, click the **add new configuration** link to create a new routing configuration.
5. Click **Save**.

### Unlinking a routing configuration from a domain

To unlink a routing configuration from a domain:

1.   Log in to the [Fastly control panel](https://manage.fastly.com) and select [**Domains**](https://manage.fastly.com/domains) from the navigation sidebar.

2. Click the name of the domain you want to apply the configuration to. 
3. From the **Domain details** page, click the **Routing** tab.
4. Click **Unlink** to unlink the routing configuration from the domain.
5. Click **Unlink** again to confirm.

## Editing routing configurations

To edit a routing configuration:

1.   Log in to the [Fastly control panel](https://manage.fastly.com).

2. Go to **Domains** > [**Routing configuration**](https://manage.fastly.com/routing/configurations). 
3. Click the name of the routing configuration you want to edit.
4. Click the pencil <span class="inline-icons"><img src="/img/icons/pencil.png" alt="Pencil icon" /></span> next to the path that you want to edit.
5. Modify the routing rules as needed. Click the trash <span class="inline-icons"><img src="/img/icons/trash.png" alt="Trash icon" /></span> to the right of a rule or condition to delete it.
6. Click **Save**.

## Deleting routing configurations

To delete a specific path and all associated rules on a routing configuration, complete the following: 

> **IMPORTANT:** A routing configuration must be [unlinked](https://www.fastly.com/documentation/guides/getting-started/domains/working-with-domains/configuring-routing-rules#unlinking-a-routing-configuration-from-a-domain) from any services or an error will appear if you try to delete it.

1.   Log in to the [Fastly control panel](https://manage.fastly.com).

2. Go to **Domains** > [**Routing configuration**](https://manage.fastly.com/routing/configurations). 
3. Click the name of the routing configuration you want to modify.
4. Click the trash <span class="inline-icons"><img src="/img/icons/trash.png" alt="Trash icon" /></span> to the right of the path you want to delete. This will delete all rules associated with the path. 
5. Click **Delete** to confirm you want to delete the path.

To delete a routing configuration, complete the following: 

1.   Log in to the [Fastly control panel](https://manage.fastly.com).

2. Go to **Domains** > [**Routing configuration**](https://manage.fastly.com/routing/configurations). 
3. Click the trash <span class="inline-icons"><img src="/img/icons/trash.png" alt="Trash icon" /></span> to the right of the configuration you want to delete.
4. If the routing configuration has been activated, enter the name of the configuration to confirm you want to delete it.
5. Click **Delete**.
