Route traffic in App Service
By default, all client requests to the app's production URL (http://<app_name>.azurewebsites.net) are routed to the production slot. You can route a portion of the traffic to another slot. This feature is useful if you need user feedback for a new update, but you're not ready to release it to production.
Route production traffic automatically
To route production traffic automatically:
Go to your app's resource page and select Deployment slots.
In the Traffic % column of the slot you want to route to, specify a percentage (between 0 and 100) to represent the amount of total traffic you want to route. Select Save.
After the setting is saved, the specified percentage of clients is randomly routed to the nonproduction slot.
After a client is automatically routed to a specific slot, it's "pinned" to that slot for one hour or until the cookies are deleted. On the client browser, you can see which slot your session is pinned to by looking at the x-ms-routing-name cookie in your HTTP headers. A request that's routed to the "staging" slot has the cookie x-ms-routing-name=staging. A request that's routed to the production slot has the cookie x-ms-routing-name=self.
Route production traffic manually
In addition to automatic traffic routing, App Service can route requests to a specific slot. This is useful when you want your users to be able to opt in to or opt out of your beta app. To route production traffic manually, you use the x-ms-routing-name query parameter.
To let users opt out of your beta app, for example, you can put this link on your webpage:
<a href="<webappname>.azurewebsites.net/?x-ms-routing-name=self">Go back to production app</a>
The string x-ms-routing-name=self specifies the production slot. After the client browser accesses the link, it's redirected to the production slot. Every subsequent request has the x-ms-routing-name=self cookie that pins the session to the production slot.
To let users opt in to your beta app, set the same query parameter to the name of the nonproduction slot. Here's an example:
<webappname>.azurewebsites.net/?x-ms-routing-name=staging
By default, new slots have a routing rule of 0%, shown in gray. When you explicitly set this value to 0% (shown in black text), your users can access the staging slot manually by using the x-ms-routing-name query parameter. They won't be routed to the slot automatically because the routing percentage is set to 0. This configuration is an advanced scenario where you can hide your staging slot from the public while allowing internal teams to test changes on the slot.
Important
The x-ms-routing-name query parameter is used on the production slot URL (for example, <webappname>.azurewebsites.net/?x-ms-routing-name=staging). The routing system serves content from the specified slot while keeping the user on the production domain. For manual routing to work, you must explicitly set the Traffic % value for the target slot (even to 0%) and save — the default gray value means no routing rule is configured and the query parameter won't take effect.