Custom 500 error handler still displaying default error text

I’ve overridden the default error handling mechanism with a custom
error handler library that’s included in environment.rb:


class ActionController::Base
def rescue_action_in_public(exception)
case exception
when ActionController::UnknownAction then
render(:file => “#{RAILS_ROOT}/public/404.html”, :status => “404
Not Found”)
else
render(:file => “#{RAILS_ROOT}/public/500.html”, :status => “500
Error”)
end
end
end

This works fine, and my custom error message gets displayed. However,
before it in the source of the html page, this is still being inserted:

Status: 500 Internal Server Error
Content-Type: text/html

How do I turn that off and display just the custom error page?

Thanks!


- Adam

** Expert Technical Project and Business Management
**** System Performance Analysis and Architecture
****** [ http://www.adamfields.com ]

[ http://www.aquick.org/blog ] … Blog
[ http://www.adamfields.com/resume.html ]… Experience
[ http://www.flickr.com/photos/fields ] … Photos
[ http://www.aquicki.com/wiki ]…Wiki

Adam/All,

Did you work this out / know how to fix this? I’m seeing the same thing
here (i.e. want to stop that text at the top of the page coming in, it’s
as
if it’s part of the HTTP 500 error message process that perhaps the
browser
puts in there?)

Question = How to stop the the “Status: 500 Internal Server Error…”
message
being inserted mysteriously at the top of the 500.html page? (or do I
have
to redirect to a rails action/view for errors to solve this? (guess
this
won’t be very good if rails itself is the issue and is not working - or
perhaps do this for exception you catch and leave the 500 error
mechanism
unchanged?)

Regards
Greg

Has anyone figured out this problem?

I noticed that it occurs with the default 500.html display as well.

Greg H. wrote:

Adam/All,

Did you work this out / know how to fix this? I’m seeing the same thing
here (i.e. want to stop that text at the top of the page coming in, it’s
as
if it’s part of the HTTP 500 error message process that perhaps the
browser
puts in there?)

Question = How to stop the the “Status: 500 Internal Server Error…”
message
being inserted mysteriously at the top of the 500.html page? (or do I
have
to redirect to a rails action/view for errors to solve this? (guess
this
won’t be very good if rails itself is the issue and is not working - or
perhaps do this for exception you catch and leave the 500 error
mechanism
unchanged?)

Regards
Greg

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs