0

I try to add a 404 page into my angularjs project which is hosted on firebase servers. I created a custom 404 page and added following code:

function routeConfig($stateProvider, $urlRouterProvider, $locationProvider)
{
    $urlRouterProvider.otherwise('/pages/errors/error-404');
}

Now it works but I am missing something because when I check in the browser's network panel the status code is "200" but it should be "404".

What should I do for that?

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Er.Se
  • 461
  • 3
  • 11
  • I'm not exactly sure about angularjs but normaly you have to set the response-code server-sided and angularjs ist a frontend framework. – flx Apr 13 '18 at 09:44

1 Answers1

0

$urlRouterProvider.otherwise just guides AngularJS that which URL it should navigate to when no URL matches the provider's rules.

This doesn't signify that a resource is not found on the server (which essentially returns 404). To do that, you need to do a lot more including serving this 404 page from the server with 404 as the status code.

Here is a resource to point you in the right direction:

31piy
  • 23,323
  • 6
  • 47
  • 67