I've got a React app build with Create-React-App running inside a docker container setup via docker-compose.
This code:
const req = new Request(
apiAdminUrl + '/login', {
method: 'POST',
body: formData
}
return fetch(req).then(processResp, processErr);
Returns TypeError: Load failed, "Failed to load resource: A server with the specified hostname could not be found."
But the curl request from the same container works without issues:
curl -d "[email protected]" -d "pwd=xxx" -X POST http://api-admin:3000/v1/login
CORS is enabled in the api code. apiAdminUrl is properly set as http://api-admin:3000/v1.
What am I missing?