Firebase hosting case-sensitive works in local but not when hosted - firebase

I am using Firebase Hosting. Hosting it in local for testing via command
firebase serve --only hosting
This hosts all files fine irrespective of the case mismatch in the urls.
Once this is Hosted onto Firebase, all the case-sensitive links are broken.
I know Firebase is case-sensitive, but how does it work in local hosting?
This would make no sense of local testing if it fails after Hosting on to cloud.

If you're working with Windows or a Macos filesystem that isn't case sensitive, then the emulator probably isn't going to discern between FOO.HTML and foo.html, since the operating system thinks they're essentially the same. Your code should always respect case, regardless of what system is hosting it - Firebase Hosting in production requires it.

Related

Firebase hosting configuration

It might be a stupid question but curious to know. I have deployed an Angular app in Firebase hosting which loads the application faster. But whereas the same application deployed in the Windows server takes too long to load.
I would like to know what would be the configuration used in Firebase hosting**(RAM, Memory)**.
From the Firebase docs, I could able to see that it uses SSD-Backed hosting but where could i find the other details like how much RAM is used and does it uses any CDN.
There doesn't seem to be any configuration for the backend or if the resources are dedicated for a website listed in the documentation. Although it's not just about the server configuration especially since your app is a SPA and is just serving some HTML, JS files, so CDN seems to be making the difference here.
Firebase Hosting does cache your website on a global CDN and hence loading quickly everywhere. I'm not sure if you are using a CDN with your Windows server but if not then the difference sounds obvious (especially if your server is located far away from you). Firebase hosting also serves the files compressed using GZIP or Brotli compression.

Firebase hosting public folder alias

I have express, react based existing project that I managed to port to Firebase hosting with cloud functions successfully..at least on the dev server.
It looks like this..
This is running on http://localhost:5000/ with command
firebase serve --only functions,hosting
Now, when I deploy this, it looks like
This is NOT a static site. Following the firebase vid here
https://www.youtube.com/watch?v=LOeioOKUKI8
So I have express server running with
app.use('/static',express.static('../public'));
I had to do this because otherwise, firebase hosting treats each path as public path and it messes up scripts sourcing from public folder and also my react router in react app.
While this works on local server run by firebae, it throws 404 on prod.
Failed to load resource: the server responded with a status of 404 ()
The point is I got all this working on local machine but the deployment just won't oblige.
The deployment was not smooth.
firebase deploy
didn't work.
firebase --only hosting
worked.
firebase --only functions
did not work for quite sometime.
It kept throwing
Error setting up the execution environment for your function. Please try again after a few minutes.
a few times before it finally worked. And I didn't change anything to make it work. Just did it by itself.
Is there something I am missing? I am very new to firebase hosting.
I already have a production site running somewhere and I wish to port it to firebase. But I can not have random 'try again after a few minutes problems'.
But first things first, why are my static files not rendering on prod when they do on dev?
Thanks
Your public directory will need to be nested beneath your functions folder, as only files within the functions folder are deployed to Cloud Functions and available from Node.js.
The local emulator is not actively guarding against this kind of tree navigation, which is why it works locally.
In general, though, you'll likely want to restructure your app a bit so that your static assets are deployed to Firebase Hosting directly rather than being served by Express.

Moving from shared windows hosting to Firebase hosting

I am currently using Windows hosting for my Android app, from a local Domain provider.
I have developed and published my app on the Firebase platform. I want to know if moving (the hosting) from current Windows hosting to Firebase will make the app respond faster?
firebase surely will respond faster as it use ssds as and seperated server cdn to reach user in global but it's just the server that cached and optimezed for faster respond it's depend to your code for threading the process for more tricky performance :)

Is "firebase serve" just a plan vanilla dev server?

Is firebase serve, the development server for Firebase, just a plain vanilla web server that serves files over HTTP, or does it do something special for Firebase apps?
More specifically, is there any reason to use firebase serve in development if it's more convenient in my situation to use another development web server (e.g., webpack-dev-server or a local Apache or IIS)?
The firebase serve command in the Firebase CLI interprets the instructions in your firebase.json file and serves the web site based on those.
If you're using another local dev server, you'll have to make sure it follows the same rules. That's typically not hard, but it somewhat of a hassle to ensure the firebase.json and configuration of the dev server stay in sync.

Store data locally on shinyapps.io

From this tutorial https://daattali.com/shiny/persistent-data-storage/, I learnt that it is not possible to store data locally on shinyapps.io
Since the responses are saved locally, this can only be used if you have access to the machine hosting the app and if you trust its filesystem. If you don't know what machine the app is hosted on, or if the files could get deleted, do not use this method. This approach will not work if hosting on shinyapps.io because of those reasons.
Is this also the case for the premium accounts? I did notice, that you can actually store data locally during the session, but cannot access it after the session close. I assume it's deleted then.
Is the same for premium accounts, and by design. The machine hosting your app can change from one session to the next, and in such case your data will be missing.

Resources