How do I fix routing errors from rails in production mode?
Asked Answered
T

1

5

If I try and access some random string in the URL of my rails app, such as /asdfasdifjasdfkj then I am seeing a rails error message

Routing Error

No route matches "/asdfasdifjasdfkj" with {:method=>:get}

Even though I am in production mode. Clearly I don't want any real users to see this, and would prefer a 404 page. Anyone know whats going wrong and how I fix it?

Thermit answered 26/9, 2008 at 11:43 Comment(0)
V
10

To get 404 you need to run server in production environment and use external ip address rather than local/loopback ip address in the url.

You can also force controller to consider all your requests as local:

  def local_request?
    return false
  end
Vedanta answered 26/9, 2008 at 11:46 Comment(1)
Thanks for this! I've been scratching my head for the last ten minutes ;)Tramline

© 2022 - 2024 — McMap. All rights reserved.