I'm using nginx with Angular and want to return a 404 when a user go to page /error404 I did the redirection with angular routing module with this :
{ path: 'error404', component: PageNotFoundComponent},
{ path: '**', redirectTo: 'error404', pathMatch: 'full'}
and to return the 404 with nginx I try this in the conf file :
error_page 404 /error404;
location /error404 {
internal;
}
or just :
error_page 404 =301 /error404;
When I go directly to /error404 I get a 404 not found and not my page but when i use the angular redirection with random url i go well on the /error404 and print my page