class

ActionDispatch::FileHandler

rails latest stable - Superclass: Object

Action Dispatch FileHandler

This endpoint serves static files from disk using +Rack::Files+.

URL paths are matched with static files according to expected conventions: path, path.html, path/index.html.

Precompressed versions of these files are checked first. Brotli (.br) and gzip (.gz) files are supported. If path.br exists, this endpoint returns that file with a content-encoding: br header.

If no matching file is found, this endpoint responds 404 Not Found.

Pass the root directory to search for matching files, an optional index: "index" to change the default path/index.html, and optional additional response headers.

Constants

PRECOMPRESSED = {\n"br" => ".br",\n"gzip" => ".gz",\n"identity" => nil\n}

Files

  • actionpack/lib/action_dispatch/middleware/static.rb