I have an Angular app in which I have
RouterModule.forRoot([
...ContentRoutes,
// this path acts like an "otherwise", so it must be the last one
{
path: '**',
redirectTo: 'home',
},
], {
paramsInheritanceStrategy: 'always',
onSameUrlNavigation: 'reload',
scrollPositionRestoration: 'enabled'
})
Therefore, if I navigate with my browser to an image that doesn't exist
http://localhost:4200/assets/images/some_image_that_doesnt_exist.jpg
I get redirected to the home page. However, if I do the same request with Postman,
I get a 404
response.
On the other hand, if I load the application to an Azure server, when I navigate to
http://<my_webpage>.azurewebsites.net/assets/images/some_image_that_doesnt_exist.jpg
I also get redirected to the main page, but when I do that request with postman, I get a 200
response and the home content.
Do you have any idea of a possible reason that could explain this difference?
Remark: the reason behind this question is trying to show an alternate image instead of showing a 404 error when the image doesn't exist. I created an endpoint in my C# Backend that checks if the image exists or not, but after the implementation, it works locally but it doesn't work on the server because I am not getting 404
errors...