# 404 rendering at custom route without redirection

**URL:** <https://meta.discourse.org/t/404-rendering-at-custom-route-without-redirection/89349>\
**Category:** Development\
**Created:** [6월 7, 2018, 9:20오전 UTC](https://meta.discourse.org/t/404-rendering-at-custom-route-without-redirection/89349 "2018-06-07T09:20:27Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

**Author:** ![arjen](https://avatars.discourse-cdn.com/v4/letter/a/b9bd4f/32.png) [@arjen](https://meta.discourse.org/u/arjen)\
**Post date:** [6월 7, 2018, 9:20오전 UTC](https://meta.discourse.org/t/404-rendering-at-custom-route-without-redirection/89349/1 "2018-06-07T09:20:27Z")

</div>

Dear Discourse community,

I have an issue I’m trying to resolve, but having little problems with it.  
The behaviour I’m trying to achieve with a custom route, is basically the behaviour you see when linking in a topic to another non-existent topic. When clicking a link to a non-existent topic, you are presented with a 404 page. When you click your browser’s Back button, you are redirected back to the topic you came from.

Now for my custom route, I notice different behaviour. So when I’m at my custom route, a JSON is retrieved from the backend, but when this JSON is not present, the controller returns a 404 page. EmberJS picks up on this, and redirects to [www.my-discourse-server.com/404](http://www.my-discourse-server.com/404). So far so good. But if I hit the back button, I go back to the non-existent page, which returns a 404 and I once again find myself at the /404 page.

Let me try to give a short indication of what the code looks like. My route:

```javascript
export default Discourse.Route.extend({
  model(opts, router, model) {
    return Ember.$.getJSON(`/custom-route/${opts.uniqueID}`);
  }
})

```

When this returns a 404, it is caught by Discourse and transitioned to ‘`exception-unknown`’ by `/discourse/app/assets/javascripts/discourse/routes/application.js.es6`.

So basically what I want is to present the user with a 404 page, without the URL redirecting to /404.

Any suggestions?

Thanks!

---

_[View the full topic](https://meta.discourse.org/t/404-rendering-at-custom-route-without-redirection/89349)._
