404 is rendered as 500 in staging and production

I have route say /status

If I hit the api /status it gives 200 which is fine.
Now when I hit /status1 it gives 500 in production but 404 in dev.

I tried spotting the difference and found that if I change my prod.exs file as

config :my_app, MyApp.Web.Endpoint,
  load_from_system_env: true,
  url: [port: 4000],
  server: true,
  debug_errors: true // introduce this

It is working as expected but I read somewhere we shouldn’t add debug_errors in prod.
Can you please suggest on this.