I use the PWA starter kit https://pwa-starter-kit.polymer-project.org/ to create websites. I host the sites on Google App Engine because it is very easy to host with and delivers the PRPL pattern right out of the box https://pwa-starter-kit.polymer-project.org/building-and-deploying#building-for-prpl-server.
However, in my new project I am using a separate subdomain for each client. And each client will have a different tenant id in my firebase database. My question is: can I intercept the http request for the PWA with a cloud function and retrieve the tenant id for the client from my database based on the requested subdomain?
In the past when I hosted everything with firebase (functions and hosting) I was able to add this to the firebase.json to redirect the http request for the PWA to a firebase function I called "renderApp"
"rewrites": [
{
"source": "**",
"function": "renderApp"
}
How can I achieve this same effect while using the Google App Engine to host my PWA? I assume there is someway, but since I don't have a firebase.json anymore I am not sure how to do it.
In short; I would like to have the tenant id baked into my PWA when I send it out to the client, but I have to look up my tenant id located in my firebase database first (based on the subdomain from the http request)