Custom Error Pages in Rails — You’re doing it wrong.

Slack’s 404 page, see https://slack.com/404
Rails.application.config.assets.paths << Rails.root.join('app', 'assets', 'html')
Rails.application.config.assets.register_mime_type('text/html', '.html')
gem 'non-stupid-digest-assets'
bundle install
NonStupidDigestAssets.whitelist = [/.html$/]
<!DOCTYPE html>
<html lang='en'>
<head>
<title>You've found a Glitch!</title>
<meta charset='utf-8'>
<link rel='shortcut icon'
href='<%= image_url('favicon.ico') %>'
type='image/x-icon'>
<%= stylesheet_link_tag 'application', media: 'all' %>
</head>
<body id='error-page'>
<%= image_tag('logo.svg') %>
<h1>You've found yourself in a weird place.</h1>
</body>
</html>
root /myapp/current/public;
error_page 404 /404.html;
location /404.html {
internal;
root /myapp/current/public/assets;
}

--

--

Founding engineer @_buildspace 🦄 Made: @snipyio @getslashdeploy Prev: @Groove , @Dockbit & Deveo Helping devs to get into Web3, one block at a time 🚀

Love podcasts or audiobooks? Learn on the go with our new app.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Tair Asim

Tair Asim

Founding engineer @_buildspace 🦄 Made: @snipyio @getslashdeploy Prev: @Groove , @Dockbit & Deveo Helping devs to get into Web3, one block at a time 🚀