Azure / Azure/static-web-apps

Does static web apps support path wildcard rewrite?

Open
#803 14 comments 29 reactions 0 assignees View on GitHub
config enhancement
Dominant language
No language data
Stars
346
Forks
67
PR merge metrics
No merged PRs in 30d

Description

How can I use route configuration to setup path wildcard write in azure static web apps?
For example, I have a website domain: https://myweb.azurestaticapps.net, and file structure like below:

- /js
- /default.js
- helper.js
- /assets
- /imgs
- /p1.jpg
- /p2.jpg

I'd like to use wildcard pattern in `rewrite` property just as what reverse proxy does.

ex:
- /myjs/default.js ----> /js/default.js
- /imgs/p1.jpg ----> /assets/imgs/p1.jpg

I've set route rewrite rules in staticwebapp.config.json but it was not work:
```json
{
"routes": [
{
"route": "/myjs/*",
"rewrite": "/js/*"
},
{
"route": "imgs/*",
"rewrite": "/assets/imgs/*"
}
]
}
```

Is there any way to do this in static web apps? please help, thanks!
BTW, I think It would really useful especially when migrating our legacy website into azure static web apps!

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.