Sunday, 11 June 2017

.Net Core hosted angular app returns 404 for all API calls

I had problem with Angular 4.0 app with .Net Core backend. I develop application using npm start which contains this call "concurrently \"webpack-dev-server --inline --hot --progress --port 8080\" \"dotnet run\" " When I was developing there wasn't any problem but when I test to run only dotnet run problems started. I managed to navigate to my login page but when I tried to login all API calls return 404 Exception. I aldo tested other API calls than login and they also returned 404.

Finally I managed to found the source of problem. So this is for those who are strugling with same kind of problem.

Cause of problem was my angular route config. There I have this line which take all API calls and return user back to login page:

{ path: '**', redirectTo: "login", }

So all-in-all you should not use ** if you host your angular app with same service with your .Net Core web API.



via Janne Harju

No comments:

Post a Comment