This project is archived and is in readonly mode.

#1972 ✓stale
Jonas Schneider

Rails metal: Throw an exception to continue the dispatch chain

Reported by Jonas Schneider | February 14th, 2009 @ 05:02 PM | in 3.x

As described here: Metal applications cannot return the HTTP Status 404 to a client, as it is used for continuing the Metal chain execution. Please use normal Rails controllers or a custom middleware if returning 404 is a requirement.

I don't think it has to be so difficult for a Metal app to return a 404... Why not just define some constant exception and continue the dispatch chain when its thrown? Makes more sense, to me at least. At the moment, you probably need to manually render the public/404.html file if you want to get 404'ish behaviour (without losing speed to the normal routing stuff). If more guys think like me, I'll try to make a patch up for this.

Comments and changes to this ticket

  • Magnus Bergmark

    Magnus Bergmark April 9th, 2010 @ 01:53 PM

    I am in favor of this. Not just because it makes sense, but also because of such a solution would reveal much more intent than returning something with the "magic value" 404.

  • Cheah Chu Yeow

    Cheah Chu Yeow April 19th, 2010 @ 10:54 AM

    I agree that returning a magic 404 feels wrong, but I'm not sure if we should affect the change in Rails 2.x in the interests of not breaking existing applications.

    In Rails edge, a "X-Cascade" header with a value of "pass" is required to continue the Metal chain.


    [404, { 'Content-Type' => 'text/html', 'X-Cascade' => 'pass' }, ['Not Found']]

    This feels sufficient to me, would you be happy with that? In fact, this undocumented change had me struggling for a few hours when trying to upgrade an app to Rails 3. I'm going to fix the documentation bug.

  • Jeremy Kemper

    Jeremy Kemper May 4th, 2010 @ 06:48 PM

    • Milestone changed from 2.x to 3.x
  • Jonas Schneider

    Jonas Schneider August 20th, 2010 @ 03:55 PM

    • Importance changed from “” to “”

    'X-Cascade' => 'pass' solves this.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:59 PM

    • State changed from “new” to “open”

    This issue has been automatically marked as stale because it has not been commented on for at least three months.

    The resources of the Rails core team are limited, and so we are asking for your help. If you can still reproduce this error on the 3-0-stable branch or on master, please reply with all of the information you have about it and add "[state:open]" to your comment. This will reopen the ticket for review. Likewise, if you feel that this is a very important feature for Rails to include, please reply with your explanation so we can consider it.

    Thank you for all your contributions, and we hope you will understand this step to focus our efforts where they are most helpful.

  • Santiago Pastorino

    Santiago Pastorino February 2nd, 2011 @ 04:59 PM

    • State changed from “open” to “stale”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>

People watching this ticket