Skip to content

Does static web apps support path wildcard rewrite? #803

Open
@robersonliou

Description

@robersonliou

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:

{
  "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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    configissues related to staticwebapps.config.jsonenhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions