I have a school project in which involves an expess backend. Cors is setup already in the backend with the official cors middleware to communicate with the front end of my project. I have an issue every time i create a post request to my backend hosted on render. I deployed it from a docker container imade.
Hi, I have the exact same issue. I am try to solve it since hours. Nothing seems to work.
I have a web application.
Flask backend
React frontend
→ So in two folders and an am deploying them together through github GitHub - PaoloOppelt/latest_GPT
I use the .env.production REACT_APP_BACKEND_URL=https://www.leitliniengpt.de/
located in my frontend folder. If i use localhost5000 and use docker locally it all works perfectly fine. Also using get on Postman
/api/status
{
“status”: “API is working”
}
Only the Post requests don’t seem to work not sure why i always get bad request 502 bad gateway? I am new to coding in general and not an expert on any of this so an easy to understand and answer is highly appreciated.
Is the problem with the way I set up my project? Or code I wrote? Feel free to briefly look at my files on Github.
If the post requests work when you run your flask locally then its probably not your code. I see you are also using cors so it cant be a cors problem. I think we’ll have to wait until a render official explains to us what the actual problem is. To double check you can also check your network tab in dev tools and your console to see any extra error messages that might occur.
Responses that are 502 responses will not contain the required CORS headers. This is because a 502 response comes from our Proxy rather than your service. You will need to resolve the issue with your service that caused the 502 response.
When you make the POST request check your service logs for errors. Also, check that your service isn’t going into an Unhealthy status.