I have a http triggered cloud function deployed in the europe-west1 region and a web app hosted with firebase hosting. I have also setup a rewrite to that http function in my firebase.json file.
I have noticed that the rewrite only works with us-central1 functions.
Is there a way to make the rewrite work with europe-west1 functions?
You can't change your domain, but you can change the host! You can make as many sites as you want.
Cloud Functions for Firebase is a serverless framework that lets you automatically run backend code in response to events triggered by Firebase features and HTTPS requests. Your JavaScript or TypeScript code is stored in Google's cloud and runs in a managed environment.
There are two types of Cloud Functions: HTTP functions, which handle HTTP requests and use HTTP triggers. See Write HTTP functions for information about implementing HTTP functions. Event-driven functions, which handle events from your cloud environment and use event triggers as described in Cloud Functions triggers.
When selecting what region to run your Cloud Functions in, your primary considerations should be latency and availability. You can generally select the region closest to your Cloud Function's users, but you should also consider the location of the other Google Cloud products and services that your app uses.
Cloud Functions is available in the following regions: us-central1 (Iowa) us-east1 (South Carolina) us-east4 (Northern Virginia)
You can set a default region using the gcloud command-line tool as follows: Cloud Functions provides a data residency guarantee at the function execution scope (Scope A Compliance—function execution), wherein a given function provides for data residency for the function invocation/execution.
To rewrite your Cloud Function link go to the /firebase.json file. In the rewrites array add this object before the existing one: Run firebase deploy --only hosting to send changes to the server.
Now that there is official support for other regions it states in the docs that "If you are using HTTP functions to serve dynamic content for hosting, you must use us-central1". So i think we have to wait and see if they will change that.
As of 2021, Hosting rewrites to functions work for us-central1 region only
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With