How to proxy network calls for SPA (static site)?

I have deploy a SPA with frontend and backend separate.

In dev mode, I am using devServer proxy.

On prod, if we use nginx, it can be done something like this

    location /api/* {
      proxy_pass http://YOUR_API_ENDPOINT;

but how to do proxy network calls to backend in render?

(a side question: what if use render private service how will it work with above question)

You could deploy an Nginx service on Render if that’s your preferred method. As you mentioned, one way you can do this is to deploy your API as a private service if you don’t need an external URL for it. You can then use the service’s internal host/port to connect to it from another Render service in your account.

If you don’t want to create an nginx service, you can use a static site rewrite rule to proxy all /api/* requests to your backend. This requires you to use a web service. If using a private service is a requirement, you’ll need to setup something like nginx.


I’ve used rewrites for this to map /graphql to my API server (also on render). It works well, but I can map to the external address only. In nginx, I am used to setting up a proxy to an internal network connection. Is there a way to setup proxies/rewrites that stick to an “internal” connection? Or, is this not an applicable question due to the nature of hosting?