Firebase Storage custom domain without hosting - firebase

I'm currently creating a website that is hosted on a vServer from another provider where you can upload images. I'm uploading the images to Firebase Storage. Can I change the domain when I rightclick -> view graphic that is my own domain? I already know that you can change the domain of firebase when you host the website there, but I don't want to host the website there.

There is no way for you to control the URL that is used to serve files directly from Firebase Storage. The download URLs are controlled by Firebase and always are based on your bucket/project name.
But Firebase server-side logic is a fairly thin wrapper around Google Cloud Storage, and you can set up a custom domain for Cloud Storage. You can ignore the parts that talk about this as being specific to hosting a web site there, as a web site on Google Cloud Storage is not much more than the files it consists of, you can apply the same to hosting other files. That should allow you to control the domain from which your files are served.
The final alternative would be to host the files on Firebase Hosting, which means they'll be served from a CDN with many global end points. The main difference here is that Firebase Hosting is typically better suited for files you generate, and not so much for files that your users generate.

Related

Version maintenance in firebase hosting while using both firebase CLI and REST API for hosting

Our app hosted on firebase hosting is currently updated via firebase CLI. However, our app may get a feature where a user can create some custom static web files and upload a zip file containing those files to our site, after which these files are available as part of the site. (like a wiki/news article). For example: if a user uploads a zip file file which contains an index.html and some images that are linked to the html file, then the site will get updated with these materials and will show them at: oursite.com/username/somearticle/index.html
Through info gathered via this page , it appears that using the Hosting REST API would be able to get the job done. However I have a few questions about the functionality offered by this solution:
To start using the API, we firstly need an access token to authenticate and authorize API requests. Is there a way to get this token for a standard user who's logged in to our site using firebase authentication?
It says in this part of the article that you need the list of all currently existing files and new files in order to update the site. How do I access the list of files that are currently a part of the site?
On a similar note like the above question, we may need to update the app functionality from time to time and those updates are done via the CLI. How do I ensure that these functionality updates don't overwrite updates made by the user? In other words, is there a way to merge updates into the hosting site using CLI commands?
Firebase Authentication users don't have enough privileges to deploy to hosting. The users will need to be collaborators on the Firebase project, which means they'll need to have a Google account.
I recommend checking out my Gist that shows how to deploy a single files, which does something quite similar that what you're trying to accomplish. It gets the list of existing files (and their hashes) in this code fragment.
"When a user uploads a file" doesn't exactly sound alike "version control" to me ...
better use Cloud Source Repositories and add a Build Trigger, which deploys to Firebase Hosting.
Here it's explained: https://cloud.google.com/build/docs/deploying-builds/deploy-firebase
I mean, how else would you'd be able to keep a version history? And if you really want to upload something, just upload, unzip, also commit to git. HTML files are perfectly suitable for that.
The general idea is to have a continuous version history, which automatically deploys itself on change.

is there any chance to host firebase app without their hosting

I have a question, so im currently building back-end less app with firebase( auth and database).
So, my question is how will work if my hosting is different(for example: superhosting.bg).If upload my app there,what should i need to run properly my app ?Can you explain me a little bit?
Firebase requires you to use Google servers. You cannot run firebase outside of Google's server-side environment. However, since you mentioned backendless (full disclosure - I am the founder), if you were to build your app with it, you can run it anywhere where Docker/Kubernetes runs.
Firebase Authentication and Realtime Database can be used from any hosting provider. There is no need to host your web site on Firebase Hosting. Just follow the setup instructions (ignoring the ones for Firebase Hosting), and you'll be good to go.
What do you actually want to transfer to superhosting.bg - you want to use a superhosting-owned domain to attach your app to or you want to use their hosting?
As Frank van Puffelen answered above, for the latter just follow bith platforms' instructions on set up. However, if you're already using firebase, I'd stick with that.
For using custom domain on superhosting with firebase, you need to add the TXT records shown in firebase to your DNS provider (superhosting). Essentially, you will need to edit the DNS Zone of your domain.
In superhosting this is done through their cPanel. Then you go to DNS zone editor and find the domain you want to edit. Once here, you have to option to add TXT registry.
To get this TXT registry, go to Add Custom Domain in firebase (docs here: https://firebase.google.com/docs/hosting/custom-domain). They'll give you a TXT code you copy in the aforementioned location in cPanel.
Et voila!

Deploy website on Firebase Hosting with specific path

I have my own domain i.e www.example.com, and I just connected with Firebase Hosting, however what I want is to deploy a website (using Flutter) for that domain and a different one with the following path: www.example.com/other, as you can see the /other should direct to another website that I have, is that possible throw Firebase Hosting? or do I need to have two domains one for each website
Firebase Hosting only deploys a single site in its entirety, using all of the content in a single folder, usually called "public" in your project. It doesn't really do partial updates scoped to a specific path.
You can certainly deploy multiple apps to one site. You will just have to make sure all of their content is added to that public folder for deployment as a unit. If you don't want to do that, you can certainly manage each site independently with a different hostname for each.

How to put a FIREBASE HOSTING site into maintenance mode?

I have a Vue.js app and use Firebase Hosting to serve the static files to users.
Does Firebase Hosting have a method for putting the app into maintenance mode remotely? Without having to do firebase deploy
Maybe something that will allow me to redirect all the traffic to some other index.html, and be able to manage it from Firebase.
P.S. I've already looked into Firebase Remote Config (and it doesn't fit my use case, and their web related tools aren't fully implemented yet). And I'd like to avoid having a realtime database just for maintenance mode.
There is no mode-switch built into Firebase Hosting for temporarily serving other content.
But given the recent updates to deploy efficiency, it should be pretty low-cost to put up a temporary index.html while making the changes. Alternatively, you could deploy rules (in firebase.json) that temporarily redirect all traffic to a wip.html (for work-in-progress).
Which of these works best, depends on your current content structure. I.e. if you already redirect "all" traffic to index.html, I'd probably go with a rewriting solution.
You can also unroll your last deploy in one command.
Deploy maintenance page
Unroll when its done
Don't forget to send a 503 error for googlebot, asking it to come back in X hours.

Serving the static content of a Firebase app

From what I can infer from the Firebase docs, it seems that
a server is required to serve the static content (the html
and javascript), so you need to have a hosted machine and a
static content server up and running somewhere, or some service
to host a static site.
Is that correct ?
Throughout the Firebase site they repeatedly mention the
"no server needed" concept, so I was initially thinking
that Firebase did provide a mean to serve static content,
but there is no mention of it in the docs.
Did I miss something ?
UPDATE
Firebase does offer static hosting now, see link in answer below.
Firebase isn't a replacement for servers in every situation, but in some cases you can use Firebase instead of a server, or reduce server code you would otherwise have to write and maintain.
If you want to serve static HTML/CSS/JS to browsers great, but Firebase won't do it for you (you would at least need to jumpstart it). In this scenario you could serve assets on any cheap hosting site, but then make those traditionally static assets data-driven via Firebase without writing any server-side code.
The docs refer to "no server needed" scenarios because traditional web applications aren't the only use-case. You could build entire real-time mobile applications or browser extensions without hosting or serving anything yourself.
Firebase now offers hosting (in Beta) for your static asset files, so they are even more a "one stop shop".
https://www.firebase.com/docs/hosting.html

Resources