firebase / firebase/firebase-tools

Firebase hosting emulator should be able to rewrite to cloud run service on localhost

Open
#1,676 21 comments 32 reactions 1 assignee Claimed by @inlined View on GitHub
emulator-suite emulators: hosting help-wanted Needs: Attention type: feature request
Dominant language
TypeScript
Stars
4.5k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
84

Description

Firebase hosting emulator rewrites work like a charm with firebase functions since we have functions emulator. However, rewrites to a cloud run service work only if service is deployed to the cloud. Now, since cloud run is super awesome and flexible, testing it locally is a matter of running docker image locally (with docker, docker-compose or even Kubernetes Minikube). This approach is much more flexible and a better choice than firebase functions for me.

My use case is server-side rendering. I want to be able to test locally which requests trigger rewrite to server-side rendering instance deployed to cloud run. That's possible if I use the firebase function.

Is there any way to make rewrites config work with generic URL and to be controlled with environment variable? For example, I would like to be able to configure rewrite to http://localhost:5555 when running firebase hosting emulator, and https://mycloudrunserviceurl.com when in production (or staging). This way it wouldn't matter where server-side rendering instance is deployed (Cloud Run, Firebase function, GKE, AppEngine).

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.