I've deployed an ASP.Net Core with react project to somee.com, the frontend loads just fine but axios.get is returning this:
{
"message": "Network Error",
"name": "AxiosError",
"stack": "AxiosError: Network Error\n at l.onerror (http://something.somee.com/static/js/main.17849c8f.js:2:700322)",
"config": {
"transitional": {
"silentJSONParsing": true,
"forcedJSONParsing": true,
"clarifyTimeoutError": false
},
"adapter": [
"xhr",
"http"
],
"transformRequest": [
null
],
"transformResponse": [
null
],
"timeout": 0,
"xsrfCookieName": "XSRF-TOKEN",
"xsrfHeaderName": "X-XSRF-TOKEN",
"maxContentLength": -1,
"maxBodyLength": -1,
"env": {},
"headers": {
"Accept": "application/json, text/plain, */*"
},
"method": "get",
"url": "http://something.somee.com:5030/api/user/null"
},
"code": "ERR_NETWORK",
"status": null
}
I did the following to ensure the endpoint is setup correctly for every axios request:
const apiUrl = process.env.REACT_APP_API_URL;
const response = await axios.get(`${apiUrl}/user/taskss/${params.id}`);
with the .env file being:
REACT_APP_API_URL=http://something.somee.com:5030
I also did this on appsettings.js:
"Kestrel": {
"Endpoints": {
"Http": {
"Url": "http://something.somee.com:5030"
}
}
},
And the Program.cs:
var hostBuilder = WebHost.CreateDefaultBuilder(args);
// Set the listening URL using the UseUrls method
hostBuilder.UseUrls("http://something.somee.com:5030");
var app = builder.Build();
// Enable CORS
app.UseCors(options => options
.AllowAnyOrigin()
.AllowAnyHeader()
.AllowAnyMethod()
);
and still nothing, what am i doing wrong here?