I have set up an Azure Static Web App with a custom domain. Both example.com and www.example.com are correctly set up and working.
I would now like to create some rule in staticwebapp.config.json so all requests coming in to https://example.com/* would redirect to https://www.example.com/*.
Is there a way to do this? I know I can do it with Front door or similar, but can I do it through rules in Static Web App?
My solution is not what you ask for but your question describes nearly exactly what I needed. So I leave a solution for my need ^^
I mainly want to redirect host to host, so https://example.com to https://www.example.com. I don't necessarily need the path.
I ended up creating a second static web app for https://example.com, added a dummy index.html and a staticwebapp.config.json with the following content:
This redirects https://example.com* to the root https://www.example.com. I didn't find a way to do it within a single static web app.
This doesn't carry the path over though. So https://example.com/path will also be redirected to https://www.example.com.