Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase Hosting - Wildcard Redirections

I want to use Firebase Hosting to host an angular application and I need to create a redirection to some old files in another URL.

According with the Firebase Documentation you can do basic redirections

"redirects": [ {
    "source" : "/foo",
    "destination" : "/bar",
    "type" : 301
}, {
    "source" : "/firebase/*",
    "destination" : "https://www.firebase.com",
    "type" : 302
} ]

But I need a wildcard redirection

"redirects": [ {
    "source" : "/config/*",
    "destination" : "//oldsiteurl/config/[match-request]",
    "type" : 302
}]

So, basically I need that myapp.firebase.com/config/some.json redirects to //oldsiteurl/config/some.json. I have a lot of json files so I do not want to match file by file.

Did you know if this is possible?

Thanks!

like image 337
Enrique Chavez Avatar asked Sep 10 '15 21:09

Enrique Chavez


People also ask

How do I remove firebase hosting setup complete?

Go to Firebase Console and select Hosting from the menu of the left. You will see the deployed project with a list of your historical actions like Deployed , disabled , etc. Only after you have disabled the site, the "three vertical dots" menu will be available for you to choose the action to delete the deployment.

What Alias do you want to use for this project eg staging?

Select the project you want to use for a different environment, and then give it an alias. The alias can really be whatever you want, but it's common to use aliases like “development”, “staging”, or “production”. Once you've created a new alias, it will be set as the current environment for deployment.

Where is my firebase json file?

Firebase automatically creates your firebase. json file at the root of your project directory when you run the firebase init command.


1 Answers

For people landing on this page, it is now possible to have wildcards in the URLs:

Sometimes it is desirable to capture parts of the source URL of a redirect and re-use them in the destination. You can do this using a : prefix to identify the segment and an optional * after the name to indicate that it should capture the rest of the URL

(source)

like image 115
gkalpak Avatar answered Sep 20 '22 19:09

gkalpak