Skip to content

Commit

Permalink
AO3-5832 Return 444 for Elasticsearch errors (#3701)
Browse files Browse the repository at this point in the history
* Redirect Elasticsearch::Transport::Transport::Errors::ServiceUnavailable to our custom error

* Follow the hound

* AO3-5832 Add a comment for 444
  • Loading branch information
zz9pzza authored and redsummernight committed Dec 2, 2019
1 parent d2928c0 commit fd853c7
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions app/controllers/application_controller.rb
Expand Up @@ -4,6 +4,11 @@ class ApplicationController < ActionController::Base
protect_from_forgery with: :exception, prepend: true
rescue_from ActionController::InvalidAuthenticityToken, with: :display_auth_error
rescue_from ActionController::UnknownFormat, with: :raise_not_found
rescue_from Elasticsearch::Transport::Transport::Errors::ServiceUnavailable do
# Non-standard code used by nginx: closes a connection without sending
# a response header.
head 444
end

def raise_not_found
redirect_to '/404'
Expand Down

0 comments on commit fd853c7

Please sign in to comment.