Private Service as API and Static Site as frontend

I was trying to setup a Flask/FastAPI Private Service to serve my frontend.

I would prefer to use a Private Service so I’m not exposing the API to the internet. But then, I ran into the same problem as described in the topic “Mixed content connecting public to private web service” (I’m not able to include links) and the solution was like “not possible”.

However, I thought that I could try to do the following: in my Static Site use a Rewrite Rule as → /api/* to http://mybackendonrender.com/api/*, but this also doesn’t seem to work as I’m getting error 502.

Does anyone know if it is possible to use this setup of a static site served by a private service API?