Search code examples
angularseoangular-universal

Angular Universal generate 404 (and other HTTP codes) header


I'm creating a website using Angular Universal. It will have server-side rendering in order to make it indexable by search engines.

I already coded my 404 fallback route, it displays its component correctly, but it displays it with a HTTP 200 header code.

How can I force a specific header code ? I googled some queries, but everything I found seemed to be about reading an HTTP call's status code, and nothing on how to write it to the browser.


Solution

  • Ok, I've finally succeeded.

    I started over, and used Angular Universal Starter (CLI), with Patrick Michalina's scripts described here : https://github.com/DSpace/dspace-angular/issues/91#issuecomment-318547118