Reputation: 1
im trying to deploy a simple MERN app with a Vercel front end and Railway back end, working perfectlly in localhost, so far the backend part seems ok, it works as expected with MongoDB and Postman. The problem im facing is that whenever I make a request from Vercel, it makes the Request URL start with the client and then the server URL.
For example the Request Url I need (and working with Postman) would be: /backend-production.up.railway.app/movements/ Instead im getting this kind of request: https://client.vercel.app/backend-production.up.railway.app/movements,
No idea why is Vercel using both client+backend URLS and mixing them up like that. My front end routes look like this:
const response = await axios(`${URL}/movements/`);
where I import ${URL} as "backend-production.up.railway.app"
Thanks in advance and let me know if I can explain myself better if needed.
Upvotes: 0
Views: 1300
Reputation: 11
I recommend adding https:// to your backend URL so will look like
https://backend-production.up.railway.app
Upvotes: 1