10 months ago
I have a problem with the reverse proxy, I set the backend and frontend to listen on port 3000
I use railway reverse proxy variables
(2 photos)
but it gives me an error that rejects the connection
(3 photos)
Project ID : 5da60841-1f6c-4e52-a848-3130a3b8ab8e
0 Replies
In mi backend i use express:
```js
console.log("Server on");
const port = Number(process.env.PORT) || 3000;
return app.listen(port, "::", () => {
console.log(Server listening on [::]${port}
);
});```
Fun fact: I had to use
in the packagejson in the backend"build": "rm -rf ./dist && tsc || true",
and in the frontend "build": "react-scripts build || true",
Why would the build stop if it had errors, even if my tsconfig was:
```"compilerOptions": {
"noEmitOnError":` false,```
10 months ago
When you are referencing something on the private network, you need the URL to be :port number
so, for your example, your frontend_domain should be app-frontend.railway.internal:3000
and your caddy config should reference the variable
This caddy repo asks you for it separately, I tried the older one that was like that and it doesn't work
10 months ago
yep the template does ask for the domain and port as separate variables.
10 months ago
the issue here is that your frontend is not listening on ipv6.
10 months ago
you would want to be using caddy
10 months ago
remove the build and start commands you have set in the service settings.
- copy the nixpacks.toml and Caddyfile from this repo into yours.