# Cannot GET error handler

**URL:** https://discourse.nodered.org/t/cannot-get-error-handler/53106
**Category:** General
**Created:** [2 November 2021 00:10 UTC](https://discourse.nodered.org/t/cannot-get-error-handler/53106 "2021-11-02T00:10:48Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![RootShell-coder](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rootshell-coder/32/47167_2.png) [@RootShell-coder](https://discourse.nodered.org/u/RootShell-coder)
#### Post date: [2 November 2021 00:10 UTC](https://discourse.nodered.org/t/cannot-get-error-handler/53106/1 "2021-11-02T00:10:48Z")

</div>

I want to customize my error handler (Cannot GET / error 404). How can i do this?

---

<div class="post-metadata">

### Author: ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)
#### Post date: [2 November 2021 09:52 UTC](https://discourse.nodered.org/t/cannot-get-error-handler/53106/2 "2021-11-02T09:52:02Z")

</div>

In what context is this? Exactly what are you doing that may cause a 404 error?

---

<div class="post-metadata">

### Author: ![knolleary](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/knolleary/32/3_2.png) [@knolleary](https://discourse.nodered.org/u/knolleary)
#### Post date: [2 November 2021 10:11 UTC](https://discourse.nodered.org/t/cannot-get-error-handler/53106/3 "2021-11-02T10:11:51Z")

</div>

I assume, but may be wrong, the question is whether you can create a flow that will serve a custom 404 page if nothing else matches the requested URL - rather than get back the default `Cannot GET /some-random-url` message.

The short answer is that no, we don't provide a way to do that reliably.

You _could_ create an HTTP In node with a path of `*`. That will match any request that _has not been matched **yet** _. In other words, if that is the _last_ HTTP In node to register itself, it will act as a catch-all route.

The problem will come if you add another HTTP In node after it for a route you do want to handle - it will be added _after_ the catch all, so requests won't reach it. You'd also get into difficulty if you use the 'modified-flows/nodes' types of deploys at that will stop/restart individual nodes and cause the route handling to be reordered.

I can't immediately think of an easy way to work around that.

---

<div class="post-metadata">

### Author: ![RootShell-coder](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/rootshell-coder/32/47167_2.png) [@RootShell-coder](https://discourse.nodered.org/u/RootShell-coder)
#### Post date: [2 November 2021 12:46 UTC](https://discourse.nodered.org/t/cannot-get-error-handler/53106/4 "2021-11-02T12:46:06Z")

</div>

I was hoping that in settings.js, since inside express, you can add something like this...

```auto
app.use(function(err, req, res, next) {
  res.status(err.status || 500);
  res.render('error', {
    message: err.message,
    error: {}
  });
});

```

and use this as the last route.

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)
#### Post date: [1 January 2022 12:46 UTC](https://discourse.nodered.org/t/cannot-get-error-handler/53106/5 "2022-01-01T12:46:39Z")

</div>

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.
