a year ago
So essentially I have a bare minimal application that uses Caddy for reverse proxying, React JS as a frontend, and a Node / Express backend that I would like to deploy to Railway. I am using Dockerfiles for each service as this is a requirement for a future project.
The current issue I am running into is probably a noob-level question but I am getting a: CORS header ‘Access-Control-Allow-Origin’ missing error. I did make sure to add cors in the server.js file:
app.use(cors())Also, an aside, I made sure to run this code as per the common errors documentation page for Railway:
app.listen(port, "0.0.0.0", () =>
{
console.log(`listening on port ${port}`)
})Here is the project link:
invite
5 Replies
Navigating to the Frontend:
https://railway-deployment-testing.up.railway.app/test
After navigating to the Frontend, there is a button which requests some API. Here is a simple GET endpoint in the Express backend:/api/v1/helloWorld
That endpoint will throw the CORS error from the React application.
Currently, the backend service is unexposed publicly and I intend to only use internal networking. However, I did test that the backend service works when it has its own exposed domain.
a year ago
The private network is IPv6 only so your application needs to bind to ::
a year ago
no problem!