firebase-hosting

Sending mail from Firebase webapp

爷,独闯天下 提交于 2019-12-03 15:20:05
问题 var express = require('express'); var app = express(); var nodemailer=require('nodemailer'); var transporter = nodemailer.createTransport('smtps://username@gmail.com:password@smtp.gmail.com'); app.get('/sendMail', function(req,res){ var mailOptions={ to: 'receiver@gmail.com', subject: 'Test Mail', html: 'Testing the Mail' } transporter.sendMail(mailOptions,function(err,response){ if(err){ res.end('Mail not sent'); } else{ res.end('Mail sent'); } }); }).listen(9091); console.log('This is

Rate Limiting on Firebase Hosting

别说谁变了你拦得住时间么 提交于 2019-12-03 14:41:23
I've been searching for ways to rate limit requests by IP, but was not able to find any resources. Basically what I'm looking is a way to implement firewall logic. I know that I can limit authenticated user requests with database rules, but how do I go about limiting page hits? For example I only want to allow 150 requests per minute for each IP. Is there any way to do this? Otherwise, wouldn't it be easy to attack small businesses who are on Blaze plan? Firebaser here. There is currently no way to rate-limit based on IP address with Firebase Hosting. Our CDN partner includes some built-in

Trouble with deep routes on a single-page app on Firebase hosting

随声附和 提交于 2019-12-03 13:59:28
(Updated below with a little more info) We have a react-based single-page web app that lives on Firebase Hosting. We've been using hash-based routing up to this point (e.g. mysite.com/#/path/to/content ). We introduced React Router, which allows us to have prettier URLs (e.g. mysite.com/path/to/content ), but now the app doesn't load when we navigate directly to a deep route. Details below: Using React Router required us to use URL Rewriting in Firebase Hosting. The directions are pretty straightforward--it seems like all you need to do is this: "rewrites": [ { "source": "**", "destination": "

How to use Cloud Functions for Firebase to prerender pages for SEO?

こ雲淡風輕ζ 提交于 2019-12-03 13:49:03
问题 The Cloud Functions for Firebase documentation here states that this can be done using cloud functions - Prerendering for single page apps to improve SEO. This allows you to create dynamic meta tags for sharing across various social networks. There are 2 questions I have: Can someone explain with an example how pre-rendering is achieved? How does this work in conjunction with Firebase Hosting? So let's say I have a webpage at xyz.com/salon/43 and in Firebase hosting I have a salon.html which

serving gzipped files on Firebase Hosting

核能气质少年 提交于 2019-12-03 12:59:27
I am interested in serving gzipped html/css/js files using Firebase Hosting. I tried setting the Content-Encoding header in firebase.json, but it errors on deploy. purportedly, the only headers you can set include: Cache-Control,Access-Control-Allow-Origin,X-UA-Compatible,X-Content-Type-Options,X-Frame-Options,X-XSS-Protection any ideas out there? By default, Firebase Hosting already gzips all of your files. Here, for example, are the response headers for a css file I have hosted on firebase. Note the Content-Encoding header: Accept-Ranges:bytes Cache-Control:max-age=7178000 Connection:keep

How to update a file that I deployed to Firebase Hosting?

女生的网名这么多〃 提交于 2019-12-03 12:28:01
On deploying my app to Firebase, I am getting this message: You're seeing this because you've successfully setup Firebase Hosting. Now it's time to go build something extraordinary! I learnt from a previous post that I need to replace the default index.html with my custom index.html . How do I do that using the Firebase Console? Frank van Puffelen You cannot change hosted files in the Firebase Console. Instead, you should change the index.html on your local copy where you initially ran the firebase deploy command. Once you're done with the changes, run firebase deploy again to push the updated

Upload single file to firebase hosting via CLI or other without deleting existing ones?

我的梦境 提交于 2019-12-03 11:36:56
Question: How to upload a single file to firebase without deleting existing files? Details: Intent: upload single file without deleting existing files on server Usage: have separate directories on local machine each uploading to a specific folder on server What I've tried: overriding the public dir with firebase deploy -p file.txt , this results in setting root public dir to use that dir. Disclosure: I work at Firebase Firebase hosting's command line tools currently requires that you have the entire web site locally, even though it will only upload the files that were modified since the last

Where to generate a PDF of Firebase Database data - mobile app, or Firebase Hosting web app

戏子无情 提交于 2019-12-03 09:09:09
I have an Android app and a web app (hosted on Firebase Hosting). The Android app generates data and saves it to the Firebase Realtime Database. Both the Android app and web app can view the data. Where is the best place to generate a PDF of the data from the Firebase Database - the Android app or the web app (via JavaScript, eg. jsPDF )? It would be saved in Firebase Storage. I thought that the Android app could call the backend to generate a PDF, and a link to the PDF would be sent back to the Android app. However Firebase is a serverless architecture, so it seems that the best solution is

Firebase hosting + React with webpack

风流意气都作罢 提交于 2019-12-03 06:10:08
问题 Is there a way to add Firebase hosting to React project that utilizes webpack? Specifically, I am trying to add it to https://github.com/mxstbr/react-boilerplate This is my firebase.json file { "hosting": { "firebase": "name", "public": "app", "ignore": [ "firebase.json", "**/.*", "**/node_modules/**" ], "rewrites": [ { "source": "**", "destination": "/index.html" } ] } } When I call firebase serve the page is empty. However, if I do npm start the app works correctly. So, the JS/React code is

How to Leverage Browser Caching in Firebase hosting

[亡魂溺海] 提交于 2019-12-03 05:53:02
问题 I have hosted my personal blog on Google's firebase. My Blog is based on jekyll. Firebase provides firebase.json file from where owner of project can modify the http header. I have my css files https://blogprime.com/assets/css/init.css and my fonts in https://blogprime.com/assets/font/fontname.woff ( http cache control not working ) My images are stored inside :: https://blogprime.com/assets/img/imagename.entension ( http cache control working ). Even though both images and css, fonts are two