Host the backend on the subdomain

Hello. I have a Nodejs + React app and I host my backend on Render. I want to host the backend on the same domain as the frontend. It is important because I need cookies to not be third-party to get them working in safari. How can I host it like that: api.frontend.com ?

1 Like

Hey there,

We let you add custom domains to services (https://render.com/docs/custom-domains) so you could have (www.)mydomain.com on your frontend and then use api.mydomain.com on the backend.

Alternatively, you could rewrite a path in the static site to your backend to your API, eg /api → api.frontend.com and then your React static site can just make requests to /api/someendpoint and it would be responded to by the server the path is being written to.

Regards,

John B

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.