Real 404s & redirects

A step of the Cloud application tree on Gradus, in the Frontend area: Second app, UI, browser tests.

Answer an unknown address with a real 404, never the application with a 200, and move old addresses with a 301.

Usually comes after: Deploy the frontend.

Prompt for your AI assistant

List every public route of the frontend and the service. Make an unknown page answer with status 404 and a helpful page marked noindex, and make a missing script, style or image answer 404 rather than the application's HTML, which a single-page host serves by default. Choose one form for trailing slashes and redirect the other, and make sure the index.html and .html forms of an address do not serve duplicates. Keep a redirect map in code for every address that has moved, answering 301 with and without a trailing slash and keeping the query. Add a post-deploy check that requests every route, a made-up page, a made-up asset and every old address and compares the status codes with a table in the repository.

This is https://gradus.kazet.blog/tree/cloud-application/step/not-found-and-redirects as plain HTML. In a browser the page also lets you mark the step forged and copy a message for your AI assistant.