❔ .NET 6 GET method returns OK even if there is no such endpoint

I've a .NET 6 Web Application with Blazor wasm front-end. When I make an HTTP GET request from front-end to back-end, even if the address I specify in the request is mapped to no controller method, the server would still respond with an OK and with the index.html page. I'd like to have a NOT FOUND answer from the server, instead. I've tried searching on the web but I had no luck until now
3 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
alkasel#159
alkasel#1592y ago
You're right, I had
app.MapFallbackToFile("index.html")
app.MapFallbackToFile("index.html")
Removing that line was enough to solve the problem 😅 Thank you very much!
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.