Heroku 500 Internal Server Error on broken pages - ruby-on-rails

My app is being hosted on Heroku and when I go to a broken page on my website (ie. www.example.herokuapp.com/mumbojumbo), i get a 500 Internal Server Error message.
Obviously, when I go to a broken page something will go wrong, I would just prefer it to show the Oops error page that I made that's on an Amazson s3 like Heroku suggests.
How can I fix this?
Right now, I already have a custom Error Page that set up in Heroku.

Related

404 Error nginx + unicorn

I have very weird issue of 404 page not found. I already have custom 404 page but my app render its own 404 page- I guess for some request my app does not get any hit for example -
(1) http://www.mymster.com/neerajsridhar renders default ngix 404 page,but
(2) http://www.mymster.com/khanimdads renders custom 404 page
The main issue is not custom 404 page but the error which is: - For point (1) above there is record in my DB ('neerajsridhar' is username in my DB), it works fine on my local machine but not in production mode.
Few inputs which may help in fixing this
a) I have used fragment caching for above page
b) Above page had 301 permanent
c) Environment is - Rails 4, ruby 2, unicorn, nginx and pagespeed.
http://www.mymster.com/stack/once-upon-a-time-in-mexico-12061 - this page do not have any 301 permanent redirect so it should work, but does not.
Any help would be appreciated.

MVC Site getting 500 error only on server, how do I get more info on error?

I have an MVC 5 web application that runs perfectly fine in VS when I debug it but the moment I deploy to my IIS server (Windows 2012 R2) I get a 500 internal server error. I have even enabled debug=true in the web.config on the server but get no detailed error. Nothing is showing in the event log I have restarted the web site in IIS and recycled the app pool with no change. What do I have to do to figure out what is not working on the server side?
By default, IIS hides debug information from remote connections. This means you need to log on to the server and browse the site there, or you need to turn off Custom errors in your web.config (change from RemoteOnly to Off).
Many kinds of configuration errors in IIS however, will only show up properly if you browse on the server.
While I did not find exactly what was wrong. I ended up rebuilding my site from the group up and in doing so I did figure out that it was something to do with the web.config but there is so much of the web.config file I left out of the new site I don't know the exact code in it that caused the problem.

symfony - 500 error page customisation problem

I am ready to push a site to production (currently on staging), but I'm having a slight problem with the internal server error 500 page.
I have created a file in web/errors/error500.php and I've also got: ErrorDocument 500 errors/error500.php in my .htaccess file
The problem is, if there is a 500 error in the admin, it displays the symfony default 500 page instead of mine in the errors folder.
Does anyone have a rough idea why this is?
I've cleared symfony cache, cleared browser cache and used several browsers.
Thanks
The standard Symfony way of doing this isn't with an Apache ErrorDocument directive, but simply by putting your error page in either <project>/apps/<appname>/config/error/error.html.php or <project>/config/error/error.html.php, for per-app or general error pages respectively. See this checklist item on the very handy Symfony Deployment Cheat Sheet.
Also make sure you are not in debug mode when you test this otherwise it will still show full stack trace.

how to handle errors like 404 / 500 in rails3

Hey, I hope you can help me.
I am trying to find a way to direct the user to the default error pages 404.html and 500.html in my public folder.
So when there is a routing or nomethod error it should be directed there to.
I already tried some stuff in my application controller but it didnt work.
Many thanks!!
Rails does this for you automatically when running in production mode. When you upload your application to a live server, Rails takes care of handling those exceptions and rendering the correct error pages with the correct header status. If you're trying to see what those pages look like (for testing or something), just access them directly via http://localhost:3000/404.html
Whenever you set up your Rails application on a live server (let's use Apache as an example), you give the site root as the /public folder in your application. Then, whenever a request is made to that server address, Apache first looks in that public folder and tries to serve a static asset (this is a configurable option in [environment].rb). If it can't find the requested page, then the request is forwarded through the Ruby stack.
When in production mode, if Rails encounters an error that isn't handled (i.e begin, rescue), it throws the error the whole way up to the stack, which then tells Apache (again, in my example) to render an appropriate error.
Here are some common errors that you'll see in development mode and what they render in production mode:
ActiveRecord::RecordNotFound => 404 (page not found)
nil.method => 500 (server error) unless you turn off whiny nils
ActionController::RoutingError => 404 (page not found)
Happens automatically if run in production mode - no need that you do that manually.
Have a look at this post to redirect all requests causing a Routing Error.

Any ideas how to troubleshoot HTTP Error 400 for MVC/Firefox?

Two clients complains on HTTP Error 400 from Mozilla Firefox 3.6.9. This happens when they open any link - both mvc application and also any static images, which are hosted on Classic application pool without any code.
Exact error message is HTTP Error 400. The request is badly formed
No errors in windows log and application error log. Proxy in browser is set to off.
Other browsers works fine for them.
Any ideas about what could cause such behavior?
For now, i can see only one option - ask them to install Firebug, but this is not really user friendly.
For some reason, cookies was corrupted and this was leading to HTTP 400 error.
After user cleaned cookies for this website he was able to get page.
I still need to investigate what exactly went wrong and find source of this problem but it is clear that I need to review all places where I do cookie creation.

Resources