proxy not working like expected

Needs Help

so I am creating a small react project and I have currently creating a registration form that checks if the username and the email exist. The server, created using express, runs on localhost:5050 whereas the react app is running on the default localhost:3000. I have read the CRA documentation and it states that a proxy is required to interact with endpoints that exist on a different port during development. I followed the documentation by adding:

"proxy":"http://localhost:5050"  

to the package.json file. However, any requests sent to the endpoints return a 304 status code and by glancing at the network tab shows that the request url starts with:

http://localhost:3000/

even though it should be a request through port 5050. I know the problem is not server side as requests to the endpoints work fine when using postman. Any advice on this problem would be highly appreciated

Posted Dec 4, 2022, 1:25 AM UTC

52
Loading comments…