Static Web App - How to carry over query strings on 301/302 Redirect using staticwebapp.config.json?

OOng 1 Reputation point
2022-04-20T00:41:46.35+00:00

Hello, I'm currently using staticwebapp.config.json to do 301 redirects to internal and external sites. Is there a setting or way to carry over query strings to the redirected route?

e.g.

"routes": [
{
"route": "/redirectme/",
"redirect": "https://www.msft.com/",
"statusCode": 301
},
{
"route": "/foo",
"redirect": "/bar",
"statusCode": 301
},
]

so is
page.com/redirectme?query=value going to msft.com?query=value
page.com/foo?query=value going to page.com/bar?query=value
possible in this file?

Azure Static Web Apps
Azure Static Web Apps
An Azure service that provides streamlined full-stack web app development.
761 questions
{count} votes

1 answer

Sort by: Most helpful
  1. ajkuma 22,401 Reputation points Microsoft Employee
    2022-04-22T20:59:34.603+00:00

    OOng-1738, I confirmed the same from our Product Group: Currently, SWA does not have a mechanism to allow query strings to be passed between redirects or to otherwise be persisted. Based on your requirement, you would need to develop client-side code to do this.

    If you wish you may submit a feature request here --- All of the feedback you share on the Uservoice will be monitored and reviewed by the Microsoft engineering teams responsible for building Azure. Users with a similar request can up-vote the post and add their comments, as well.

    Kindly be assured that your feedback has also been relayed internally to our product engineering team.
    Once again, apologies for any inconvenience with this. We appreciate your valuable feedback.

    --
    To benefit the community find the right answers, please do mark the post which was helpful by clicking on Accept Answer’ & ‘Up-Vote’.

    1 person found this answer helpful.