a year ago
My frontend can't connect to my backend when I use the internal url. I'm using bun to host my server and when going to the backend's public domain it works. I've attempted connecting with a variety of options, with/without https, with/without port.
45 Replies
a year ago
With 'frontend' do you mean your frontend code?
so this is the api url my frontend is using https://prophesy-backend.railway.internal
Well, international urls are pointing to internal domain names that are resolved by the container runtime
I'm hosting my frontend here: https://prophesy-web-production.up.railway.app/
and I want to connect to the backend service
Just to reiterate, what you are saying is that you want your backend to be publicly accessible without being exposed to public
U gotta property configure it and then you'll be only able to access ur BE from ur FE domain
But tldr is that you CAN NOT truly prevent anyone online from marking requests to a service that is publicly exposed on the internet
so what url would I reference with cors? and how do I set up my backend service on railway with that
Because if a legit front end domain can access a service, than can anyone else
I thought railway has a feature where the services within a project can access each other, but outside things can't
so do I keep the public domain with my backend service, and use cors to block requests from other domains?
Private networks make sense when you have services that aren't exposed to public in any way, like a database to backend connection
You would need to explicitly allow the legit domains and reject requests from any others
a year ago
!s
Status changed to Solved dev • about 1 year ago
