I'm currently building an app. I need to do an api call to firebase (via the API feature & not the integrated cloud function feature of FF). I need to route the api request through a custom domain like api.customdomain.com through cloudflare network, which has its dns records created in cloudflare with nameservers of CF are already set in hostinger.
When i am testing the api i'm getting error, but without routing the request through CF network and custom domain, the direct API call to firebase works fine.
Upon asking AI with the specific error, it says that the request is appending the url end point to https://secure-ridge-22999-537c838d4a8a.herokuapp.com/ and the error is:
Error: ClientException: Failed to fetch, uri=https://secure-ridge-22999-537c838d4a8a.herokuapp.com/https://api.customdomain.com/getVideo
where the getVideo is the cloudfunction name
customdomain is my custom domain
Help me i need to route the request in this manner
These are the headers i'm getting while testing the function:
{
"access-control-allow-origin": "*",
"alt-svc": "h3=\":443\"; ma=86400",
"cache-control": "private, no-store",
"cf-cache-status": "DYNAMIC",
"cf-ray": "94f2fef43af05afe-IAD",
"content-length": "0",
"date": "Fri, 13 Jun 2025 16:34:31 GMT",
"nel": "{\"report_to\":\"heroku-nel\",\"response_headers\":[\"Via\"],\"max_age\":3600,\"success_fraction\":0.01,\"failure_fraction\":0.1}, {\"report_to\":\"cf-nel\",\"success_fraction\":0.0,\"max_age\":604800}",
"report-to": "{\"group\":\"heroku-nel\",\"endpoints\":[{\"url\":\"https://nel.heroku.com/reports?s=ahoagCRdC%2FlDpzfFk5bfeX3QSmNA3oYRvKAIbjC8O8E%3D\\u0026sid=1b10b0ff-8a76-4548-befa-353fc6c6c045\\u0026ts=1749832471\"}],\"max_age\":3600}, {\"group\":\"cf-nel\",\"max_age\":604800,\"endpoints\":[{\"url\":\"https://a.nel.cloudflare.com/report/v4?s=7RuGZs9DXR0nZkXFFpCjQ3pbh0odQrL%2FkkN6Wk7KsDJwU%2FeCtkQ0OuxYnppvsiRVt%2F2%2BlDtng%2BM0uxO4%2FmWt3KcxMuigdx6ezmHIiJbUs%2BLCRhmA7A%3D%3D\"}]}",
"server": "Heroku",
"x-final-url": "https://api.customdomain.com/getVideo"
}