Expose only one of two services
I have two services in Railway,
back-end
and front-end
. I want only front-end
to be exposed publicly, that is, back-end
shouldn't be able to be called from any origin other than front-end
. Is there a way to achieve this?Solution:Jump to solution
if you want to do what you are asking, you would need a server side rendered app, where the server makes an internal request to the backend api, renders the page with data and returns the fully rendered page to the user
18 Replies
Project ID:
499c211e-ee48-4f8d-9cbf-b5569a601a8d
499c211e-ee48-4f8d-9cbf-b5569a601a8d
no, the frontend would need a publicly available domain to call for data
but isn't the two services hosted on the same "environment"? like, isn't
front-end
local to back-end
and vice-versa?
if not, how can I achieve that besides Railway?is frontend a web app?
yep
next?
angular
is it a CSR app?
no, I need node
so SSR?
no, sorry, it is CSR
then the backend needs to have a public url for the frontend to call
since the api call from the frontend will be made by the user not from within railway
ohhh, that makes sense
Solution
if you want to do what you are asking, you would need a server side rendered app, where the server makes an internal request to the backend api, renders the page with data and returns the fully rendered page to the user
got it
thanks again, @Brody
any other questions?
nope!