Azure / Azure/static-web-apps

Route traffic to environment based on query parameter

Open
#1,421 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

**Is your feature request related to a problem? Please describe.**
I have a need to route users to a specific SWA environment based on a routing cookie that is set automatically when a `x-ms-routing-name` query parameter is supplied in the URL. This is currently possible with App Service (see [here](https://learn.microsoft.com/en-us/azure/app-service/deploy-staging-slots?tabs=portal#route-production-traffic-manually))

**Describe the solution you'd like**
I'd like to not have to visit a specific domain to be routed to an environment. I would like SWAs to use the `?x-ms-routing-name-XXX` convention to set a cookie in my browser that manually routes me to a staging environment .

You should also be able to say `?x-ms-routing-name=self` to return to the production environment.

Ideally the approach will match exactly how App Services currently achieve this.

**Describe alternatives you've considered**
N/A

**Additional context**
This is often useful for performing traffic routing on the same domain as the production environment, i.e. if you have a custom domain that is added to CORS policies and auth callback URLs, you cannot fully test features on a environment specific URL

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.