102

What is the purpose of this Rails config setting...

config.action_controller.consider_all_requests_local = true

It's set to true by default in config/environments/development.rb.

Thanks,

Ethan

mat
  • 12,943
  • 5
  • 39
  • 44
Ethan
  • 57,819
  • 63
  • 187
  • 237

2 Answers2

131

Non-local requests result in user-friendly error pages. Local requests, assumed to come from developers, see a more useful error message that includes line numbers and a backtrace. consider_all_requests_local allows your app to display these developer-friendly messages even when the machine making the request is remote.

Gordon Wilson
  • 26,244
  • 11
  • 57
  • 60
  • 11
    The Rails default error message is only *marginally* friendly. It also serves another purpose, though, which is to not show too much information about the internal error to outsiders who might want to use that information against you. – Gordon McCreight Oct 02 '13 at 02:50
  • Could this change the response status and headers? Say, if I'm trying to return a `503` but a client is receiving a `500`? – PJSCopeland Oct 03 '19 at 20:48
7

At development level we set:

consider_all_requests_local set = true

because developer needs to take a look at full error showing layout/view as you can see in the image below.

enter image description here

But at production level, we don't need to show our internal coding bug so we set false:

config.consider_all_requests_local = false

enter image description here

Touseef Murtaza
  • 1,548
  • 14
  • 20