---
title: "Origin Selection (Modifies Client Request)"
slug: "origin-selection-modify-client-request"
updated: 2025-02-26T15:01:22Z
published: 2025-02-26T15:01:22Z
stale: true
---

> ## Documentation Index
> Fetch the complete documentation index at: https://docs.qwilt.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Origin Selection (Modifies Client Request)

## Overview

Configure an Origin Selection rule to direct certain client requests (such as requests from a specified user agent) to an alternate origin.

This is a *Processing Stages* rule that is applied to the client request. If you add this rule to a path configuration, it is important to understand the inheritance logic. [Learn more about Processing Stages rules.](/v1/docs/processing-stages)

## Configure the Rule

Here, we'll describe how to configure the rule with the Delivery Service Management UI.

API Users may choose to [build the site configuration offline](https://api-docs.qwilt.cqloud.com/docs/CDN%20APIs/Sites%20API/prepare-the-configuration-json).

**To configure an Origin Selection rule:**

1. [Navigate to the Select Rule dialog](/v1/docs/add-a-rule).
2. In the Select Rule dialog, choose **Origin Selection**. ![OriginSelectionMain80.png](https://cdn.document360.io/fa039225-513b-46a1-ba78-a57a1f1cb7c6/Images/Documentation/OriginSelectionMain80.png)
3. Create the match condition.

          
          

**Tip:** See the [MEL Quick Reference](/v1/docs/mel-quick-reference)
4. Configure the origin.

          
          

**Tip:** Find descriptions of the origin configuration fields in these articles: [Single Origin](/v1/docs/configure-a-single-origin), [Origin with Failover](/v1/docs/configure-a-failover-origin), [Round Robin List](/v1/docs/configure-a-round-robin-origin).

![OriginSelectionRuleAdd80a.png](https://cdn.document360.io/fa039225-513b-46a1-ba78-a57a1f1cb7c6/Images/Documentation/OriginSelectionRuleAdd80a%281%29.png)
5. Choose **Add Rule**.

## SVTA Component: MI.ProcessingStages

When you save the site configuration, the Origin Selection rule is added to the JSON configuration as a **client-request** component within the **MI.ProcessingStages** component.

```
{
	"generic-metadata-type": "MI.ProcessingStages",
	"generic-metadata-value": {
		"client-request": [
			{
				"stage-metadata": [
					{
						"generic-metadata": [
							{
								"generic-metadata-type": "MI.SourceMetadataExtended",
								"generic-metadata-value": {
									"sources": [
										{
											"protocol": "https/1.1",
											"endpoints": [
												"example.alternate.origin.com"
											]
										}
									]
								}
							}
						]
					}
				],
				"match": {
					"expression": "req.h.user-agent ~= 'Mozilla'"
				}
			}
		]
	}
}
```

In this example, all requests that are received from a Mozilla user agent (the match condition) are redirected to *example.alternate.origin.com*.

Note the two nodes nested under "**client-request**":

- The **MI.SourceMetadataExtended** object defines the origin configuration. In this example, a single origin host is configured. However, you could also configure a failover or round-robin origin type.
- The **"match"** field contains the MEL expression that sets the condition for directing a request to the alternate origin. In this example, the condition is if the user-agent is Mozilla.
