Firebase hosting / auth / cloudstore hosted on a server in Australia - firebase

I have a requirement to host a web app that uses Firebase services on a server physically located in Australia. Can anyone tell me if this is possible and if so is there any documentation available around this? I would be using Firebase Hosting / Auth / Firestore - all would need to be hosted in Australia.

Firebase Hosting is hosted on a global CDN network. You can't restrict where it is server or accessed from.
Firebase Authentication data is also stored globally, outside of your control.
I'm not sure what Cloudstore is, but given the above two answers you might already want to look at alternative products.

Related

Firebase - restrict API key for web application

I just got a mail from the Firebase support that my current API key restrictions for the Firebase API key lead to malfunctions for the Firebase Installation API. Since, I have a web application and not an iOS or an Android app, I´m assuming that this is not a real issue for me at the moment.
However, this got me wondering if I enabled all necessary HTTP referrers (websites) in the Google Cloud Platform to ensure a working environment for my web application. Let´s say my domain is called www.domain.com and my Firebase project is called projectx. I currently have these two entries in the HTTP referrers for the Application restrictions:
www.domain.com/*
projectx.firebaseapp.com/*
Is there anything else I should enable? Because I saw that Firebase also enables multiple domains such as projectx.web.app by default.
It's fairly simple: you need to enable the domains that your app uses.
The two domains you have are the defaults for cases where you have a common domain:
www.yourdomain.com/* is the custom domain that you typically share out with people.
projectx.firebaseapp.com is the default domain generated by Firebase, and is typically also used in sign-in screens (although you can change this).
You may also want to add:
projectx.web.app, which is a newer default domain that Firebase creates. But this is not required, so only add it if you expect to hand it out to folks.
localhost, which is handy for local testing

What is firebase hosting for?

What is Firebase Hosting for? Examples? I'm not clear on what it does with respect to hosting a website or server or both....
My understanding of hosting is that one would enlist something like Bluehost or GoDaddy to host a webpage, which they would then upload the website files via an FTP. I see it appears Firebase Hosting may serve a similar purpose and you can add your own domain name like this.
I also understand that websites sometimes require a separate server to do things like: processing requests while keeping secret keys hidden, or rendering a unique webpage server-side and sending a static page to the user. I've used Firebase Realtime Database for non-secure data storage, but I would like to be able to use the hosting as well for serving private user-specific content without exposing keys.
I just did a tutorial to create what seemed like a web app that one would query from another webpage, but I wasn't able to deploy and try it out because of the pay-wall.
Can Firebase Hosting be my secondary server that processes private requests to a database or is it only for hosting a user-facing webpage, or both?
I am new to programming and would appreciate hearing if it seems like I am misunderstanding something within my question. Recommended resources for further learning on this subject are greatly appreciated!
Thank you.
Hosting a static web site
Firebase Hosting on its own is a service for hosting static assets. So in your scenario HTML + CSS + Images + JavaScript files that are included in them. None of this content is executed, or in any other way interpreted, on the Firebase servers. You upload (in Firebase terms "deploy") the files to Firebase, which then distributes then to its global CDN edges, and when your site is visited, the content it served from that CDN.
In the Firebase documentation on what can you host this is referred to as:
Host your single-page web apps, marketing websites, and static and dynamic assets
Hosting a static web site with dynamic content
You can use Firebase with many of the other back-end services to add dynamic functionality to your static web site. For example, you can call Realtime Database from your client-side JavaScript code, and display dynamic data in your static web app that way. Firestore would be similar, which you could use in place of Realtime Database. Similarly you can use Firebase to connect to Cloud Storage, for storing of files, for example to allow your users to upload and view images.
And then you'll typically want to secure access to all this dynamic content. At that point, you use Firebase Authentication to allow your users to sign in, and when you'll use Firebase's server-side security rules, which are available for Realtime Database, Cloud Firestore and Cloud Storage. These rules determine what data or files the users can access.
The Firebase documentation covers this in the section on deep integrations with other Firebase products.
Firebase Hosting works out-of-the-box with Firebase services, including Cloud Functions, Authentication, Realtime Database, Cloud Firestore, and Cloud Messaging. You can build powerful microservices and web apps using these complementary Firebase services.
Adding dynamic server-side pieces to web site
You can integrate Firebase Hosting with Google Cloud Functions and Cloud Run to build dynamic web sites. In those scenarios, you host the server-side code on Cloud Run or Cloud Functions, and set Firebase Hosting up to redirect certain URLs to specific end points in your server-side code.
In the Firebase documentation on what can you host this is referred to as:
Pair Firebase Hosting with Cloud Functions to build microservices using the Express.js framework. This pairing allows you to host your microservices and APIs on Firebase.

Firebase Hosting doesn't has firewall?

Having one of application hosted on Firebase with some additional services there (Cloud Firestore, Cloud Storage for Firebase, Cloud Functions for Firebase) decided to make some security scanning. One of the tools https://sitecheck.sucuri.net/ shows me that there's no firewall for it, is it possible? It has reverse proxy & Fastly's CDN, but would be a firewall missing for apps hosted on Firebase Hosting?
Firebase hosting resources access is unfortunately not restricted by any means, check out the question below?
Can Firebase restrict access to resources?
However, There are things you can do in the regard of security:
Use Cloud functions to render dynamic resources and microservices
https://firebase.google.com/docs/hosting/functions
Use Firestore rules to secure the data access
Use Firebase authentication to make sure that only authenticated users can do certain actions
Even though, we all hope for that firewall option to be added.
Best Regards
Firebase Hosting does not have a firewall feature. If you publish content to it, that will be accessible from anywhere there is an internet connection.

Secure a firebase hosting link to only be accessible from a specific ip

I am using angular 4 angularfire 2 and firebase in an web app. I am conditionate to use firebase as a backend service and because the app has to only be used inside the office i am wondering if there is any way i can configure some firebase rules or anything to make the app not work or be shown from another ip than the office ip. Please leave any kind of way i can do it. Thanks in advance!
There is currently no way to restrict access to a site deployed to Firebase Hosting. It will always be accessible from anywhere in the world that is not blocked by some other firewall.

Can static web apps access outside services?

I have been working on a web app and I am now looking into hosting said app. This app is a client-side app for right now meaning that all of the work is being done on the clients device and it has no backend other than the web server giving the site to the user for the first time.
I was looking into Heroku but that seems expensive for my app. Then I looked into Firebase Hosting and it looks good but requires the site to have static content. For now I'm pretty sure my app fits that criteria but in the future I would like to have users sign up for accounts and then store the info they give for the app data in a database. Would do database calls to a firebase database make the app non-static/dynamic anymore?
I know I could use Digital Ocean or another server provider but I want to be able to have scaling done for me so I can just focus on the app and not the containers themselves.
It sounds like you might want to build your app with Firebase Authentication for user logins, store data in Firebase Realtime Database, and host all the content on Firebase Hosting. You could probably write the code entirely in JavaScript to run in the browser, but if you did need to write some code on the backend, you could use Cloud Functions for Firebase.

Resources