You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When we 404 (or other error) in the browser we currently return JSON. This is a terrible mediocre user experience. In general, we should default to JSON responses because Nexus is primarily a JSON API. Fortunately, as you can see in the screenshot, when we get a request from a browser (or more concretely, a request to which we would prefer to respond with HTML) we can tell from the Accept header on the request.
We could instead use the presence or lack of /v1 prefix on the path, since that's the implicit marker for API vs. Console requests, but I think the HTML header is better: we're just doing what they tell us to do. They say they want HTML, give them HTML.
What should the HTML be? The web console currently generates the assets served as console pages, including an index.html which is mostly a dummy container for a React app to run in. The console can easily generate other HTML pages (Vite docs on multiple entry points). This has the advantage of keeping the console responsible for all HTML and CSS, and we could reuse our existing styling.
Activity
[-]Need HTML error pages for HTML requests[/-][+]HTML error pages for HTML-wanting requests[/+]