So on the official firebase documentation it looks pretty straightforward to see that we can direct requests to our Cloud Run via proxy.
https://firebase.google.com/docs/hosting/full-config#rewrite-cloud-run-container
So its says if you add your cloud run's serviceId it will be done:
"hosting": {
// ...
// Directs all requests from the page `/helloworld` to trigger and run a `helloworld` container
"rewrites": [ {
"source": "/helloworld",
"run": {
"serviceId": "helloworld", // "service name" (from when you deployed the container image)
"region": "us-central1" // optional (if omitted, default is us-central1)
}
} ]
}
However this does not cover my problem where you have different projects so you cannot directly give the container image/ service name. They are on the same account but in different projects.
I tried giving the direct destination:
"rewrites": [
{
"source": "/api/**",
"destination": "MY-CLOUD-RUN-APP-URL>/api/**"
},
{
"source": "**",
"destination": "/index.html"
}
However this didnt solve my problem.
This is not possible. The configured Cloud Run instances must be in the same project as Firebase Hosting.
You could possibly set up a Cloud Run container to forward/proxy HTTP requests to another publicly accessible Cloud Run instance in another project (or any other HTTP service for that matter).