Lathif Jumatiawan
Lathif Jumatiawan

Reputation: 75

Firebase Hosting Rewrite URL

is there any way to rewrite this URL in firebase.json ?

http://localhost/api/whatever/product.json

to become

http://localhost/api/product.json

whatever means any kind of path, so I expect if we insert that whatever path, then the browser will not redirect to 404 but redirect to

http://localhost/api/product.json

Thanks

Upvotes: 1

Views: 1485

Answers (1)

Frank van Puffelen
Frank van Puffelen

Reputation: 600061

That's a pretty regular rewrite with a glob pattern as far as I can see. Based on the documentation on Firebase Hosting rewrites it should be something like:

"hosting": {
  // ...

  "rewrites": [{
    "source": "**/product.json",
    "destination": "/api/product.json"
  }]
}

Upvotes: 4

Related Questions