Firebase overwrite VueJS single user app in subfolder

Background

I have a website that is structured like this:

root
  — /public
    — index.html <— landing page404.html
    — /library 
      — index.html <— single page VueJS app

      

The single page app is here: https://uxtools-3ac6e.firebaseapp.com/library/

Here's my firebase.json:

{
  "database": {
    "rules": "database.rules.json"
  },
  "hosting": {
    "public": "public",
    "rewrites": [
      {
        "source": "/library/*",
        "destination": "/library/index.html"
      }
    ]
  }
}

      

Problem

When the app starts routing to additional paths like https://uxtools-3ac6e.firebaseapp.com/library/lists/order-group-best-sources-learn-ux , the update will be redirected to 404 instead of library / index. HTML.

+3


source to share


1 answer


You need to use a double star globe to match:

"source": "/library/**"

      



A single star will only match a forward slash, so it will match /library/lists

but not /library/lists/foo

.

+8


source







All Articles