This project is archived and is in readonly mode.

#5335 ✓invalid
Michael Henriksen

Requests to public files are being sent through the router in production env

Reported by Michael Henriksen | August 8th, 2010 @ 01:53 PM

When running projects in production environment (rails server -e production) all requests to files in the public folder (robots.txt, CSS files, Javascripts, etc.) are for some reason being sent through the Rails router, instead of being served directly. This causes the following error message in the log:

ActionController::RoutingError (No route matches "/"):

When starting up the server in development mode, there is no problem.

System information:

Operating system: Mac OS X 10.6.4 Snow Leopard
Ruby version: 1.8.7
Rails version: 3.0.0.rc

Comments and changes to this ticket

  • Chris Mear

    Chris Mear August 8th, 2010 @ 02:25 PM

    • Tag changed from, actioncontroller, routing to, actioncontroller, invalid, routing

    Rails 3 has a new default config option in production:

    config.serve_static_assets = false

    which would cause the error you're seeing. (Normally in actual production you'd have a front-facing web server like Apache, which would handle the request for static files before it reached the Rails router, so you wouldn't get this error). So, I think this is intentional.

  • Michael Henriksen

    Michael Henriksen August 8th, 2010 @ 03:00 PM

    Ah okay, sorry for that!

    Thanks for your help :)

  • Rohit Arondekar

    Rohit Arondekar August 9th, 2010 @ 11:57 AM

    • State changed from “new” to “invalid”
    • Importance changed from “” to “Low”

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>