Set up reverse proxy using template
I am trying to set up a reverse proxy using the template here: https://railway.app/template/7uDSyj
I have configured the FRONTEND_HOST and BACKEND_HOST to be (for example) ${{app-ui.RAILWAY_PRIVATE_DOMAIN}}:3000 and ${{app-be.RAILWAY_PRIVATE_DOMAIN}}:3000. Both services are running on port 3000.
I am getting the error in the picture when trying to start the reverse proxy but I am not sure why.
Thank you.
25 Replies
Project ID:
8901e750-2bdf-424d-ae30-eeab10952fcc
Project ID:
8901e750-2bdf-424d-ae30-eeab10952fcc
8901e750-2bdf-424d-ae30-eeab10952fcc
can you send a screenshot of the railway project that has the proxy service in it?
is this what you want?
my env variables for the caddy reverse proxy:
BACKEND_HOST: flight-info-agg-be.railway.internal:3000
FRONTEND_HOST: flight-info-agg-ui.railway.internal:3000
are those the correct private domains according to the service settings?
i found out that the reverse proxy is never touched after deployment, as in there is no request to it
the error i showed was from the build which was successful
?
yes they are
do you have this service variable? https://docs.railway.app/guides/private-networking#workaround-for-alpine-based-images
no i dont
go ahead and add it to the proxy service
I just added it. It is still not working.
show me please
show me the new errors please
the deployment log is the same as my first post. the problem seems to be that no traffic is touching the reverse proxy
maybe you arent understanding the purpose of the reverse proxy?
Yes I think maybe i misunderstood something. If my ui can be accessed on https://abc.railway.app and i have this reverse proxy set up, I think i should be able to health check my backend by accessing https://abc.railway.app/api/health ? Am i correct in saying that?
depends, whats the domain you have on the proxy service
852 Flight Deals
Hong Kong's flight-related discounts and deals
you access your frontend and backend throught this domain
oh
thats it. i thought i could access the frontend and backend using the frontend's domain.
i guess that solves the issue. let me check.
it works! thank you!
one more question: should i call my backend from frontend using the proxy's domain?
the purpose of the proxy was so that you can call the backend by just specifying a path instead of a full domain