class ActionDispatch::Static

Experimental RBS support (using type sampling data from the type_fusion project).

# sig/action_dispatch/middleware/static.rbs

class ActionDispatch::Static
  def call: (Hash env) -> Array[Integer]
end

Only files in the root directory are served; path traversal is denied.
are handed off to the main app.
Only GET and HEAD requests are served. POST and other HTTP methods
the public/ directory.
In Rails apps, this middleware is configured to serve assets from
If no file is found, it hands off to the main app.
This middleware serves static files from disk, if available.

def call(env)

Experimental RBS support (using type sampling data from the type_fusion project).

def call: ((rack.version | Integer | rack.errors | IO | rack.multithread | TrueClass | rack.multiprocess | FalseClass | rack.run_once | FalseClass | rack.url_scheme | String | SCRIPT_NAME | String | QUERY_STRING | String | SERVER_SOFTWARE | String | GATEWAY_INTERFACE | String | REQUEST_METHOD | String | REQUEST_PATH | String | REQUEST_URI | String | SERVER_PROTOCOL | String | HTTP_HOST | String | HTTP_SEC_FETCH_SITE | String | HTTP_ACCEPT_ENCODING | String | HTTP_COOKIE | String | HTTP_CONNECTION | String | HTTP_SEC_FETCH_MODE | String | HTTP_ACCEPT | String | HTTP_USER_AGENT | String | HTTP_REFERER | String | HTTP_SEC_FETCH_DEST | String | HTTP_ACCEPT_LANGUAGE | String | puma.request_body_wait | Float | SERVER_NAME | String | SERVER_PORT | String | PATH_INFO | String | REMOTE_ADDR | String | HTTP_VERSION | String | puma.socket | TCPSocket | rack.hijack? | TrueClass | rack.hijack | Puma::Client | rack.input | Puma::NullIO | rack.after_reply |  | puma.config | Puma::Configuration | action_dispatch.parameter_filter | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | action_dispatch.redirect_filter |  | action_dispatch.secret_key_base | String | action_dispatch.show_exceptions | TrueClass | action_dispatch.show_detailed_exceptions | TrueClass | action_dispatch.log_rescued_responses | TrueClass | action_dispatch.logger | ActiveSupport::Logger | action_dispatch.backtrace_cleaner | Rails::BacktraceCleaner | action_dispatch.key_generator | ActiveSupport::CachingKeyGenerator | action_dispatch.http_auth_salt | String | action_dispatch.signed_cookie_salt | String | action_dispatch.encrypted_cookie_salt | String | action_dispatch.encrypted_signed_cookie_salt | String | action_dispatch.authenticated_encrypted_cookie_salt | String | action_dispatch.use_authenticated_cookie_encryption | TrueClass | action_dispatch.encrypted_cookie_cipher | NilClass | action_dispatch.signed_cookie_digest | NilClass | action_dispatch.cookies_serializer | Symbol | action_dispatch.cookies_digest | NilClass | action_dispatch.cookies_rotations | ActiveSupport::Messages::RotationConfiguration | action_dispatch.cookies_same_site_protection | Proc | action_dispatch.use_cookies_with_metadata | TrueClass | action_dispatch.content_security_policy | NilClass | action_dispatch.content_security_policy_report_only | FalseClass | action_dispatch.content_security_policy_nonce_generator | NilClass | action_dispatch.content_security_policy_nonce_directives | NilClass | action_dispatch.permissions_policy | NilClass | action_dispatch.routes | ActionDispatch::Routing::RouteSet | ROUTES_13500_SCRIPT_NAME | String | ORIGINAL_FULLPATH | String | ORIGINAL_SCRIPT_NAME | String | action_dispatch.authorized_host | String | action_dispatch.request_id | String | action_dispatch.remote_ip | ActionDispatch::RemoteIp::GetIp | rack.session | ActionDispatch::Request::Session | rack.session.options | ActionDispatch::Request::Session::Options | rack.tempfiles |  | action_dispatch.request.path_parameters | controller | String | action | String | gem | String | version | String | action_controller.instance | GemsController | action_dispatch.request.content_type | NilClass | action_dispatch.request.request_parameters |  | rack.request.query_string | String | rack.request.query_hash |  | action_dispatch.request.query_parameters |  | action_dispatch.request.parameters | controller | String | action | String | gem | String | version | String | action_dispatch.request.accepts |  | action_dispatch.request.formats |  | rack.request.cookie_hash | _gemsh_session | String | _skillit_session | String | token | String | rack.request.cookie_string | String | action_dispatch.cookies | ActionDispatch::Cookies::CookieJar | action_dispatch.request.unsigned_session_cookie | session_id | String | _csrf_token | String | flash | discard |  | flashes | notice | String | rack.version | Integer | rack.errors | IO | rack.multithread | TrueClass | rack.multiprocess | FalseClass | rack.run_once | FalseClass | rack.url_scheme | String | SCRIPT_NAME | String | QUERY_STRING | String | SERVER_SOFTWARE | String | GATEWAY_INTERFACE | String | REQUEST_METHOD | String | REQUEST_PATH | String | REQUEST_URI | String | SERVER_PROTOCOL | String | HTTP_HOST | String | HTTP_SEC_FETCH_SITE | String | HTTP_ACCEPT_ENCODING | String | HTTP_IF_NONE_MATCH | String | HTTP_SEC_FETCH_MODE | String | HTTP_ACCEPT_LANGUAGE | String | HTTP_ACCEPT | String | HTTP_USER_AGENT | String | HTTP_REFERER | String | HTTP_UPGRADE_INSECURE_REQUESTS | String | HTTP_CONNECTION | String | HTTP_COOKIE | String | HTTP_SEC_FETCH_DEST | String | puma.request_body_wait | Float | SERVER_NAME | String | SERVER_PORT | String | PATH_INFO | String | REMOTE_ADDR | String | HTTP_VERSION | String | puma.socket | TCPSocket | rack.hijack? | TrueClass | rack.hijack | Puma::Client | rack.input | Puma::NullIO | rack.after_reply |  | puma.config | Puma::Configuration | action_dispatch.parameter_filter | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | action_dispatch.redirect_filter |  | action_dispatch.secret_key_base | String | action_dispatch.show_exceptions | TrueClass | action_dispatch.show_detailed_exceptions | TrueClass | action_dispatch.log_rescued_responses | TrueClass | action_dispatch.logger | ActiveSupport::Logger | action_dispatch.backtrace_cleaner | Rails::BacktraceCleaner | action_dispatch.key_generator | ActiveSupport::CachingKeyGenerator | action_dispatch.http_auth_salt | String | action_dispatch.signed_cookie_salt | String | action_dispatch.encrypted_cookie_salt | String | action_dispatch.encrypted_signed_cookie_salt | String | action_dispatch.authenticated_encrypted_cookie_salt | String | action_dispatch.use_authenticated_cookie_encryption | TrueClass | action_dispatch.encrypted_cookie_cipher | NilClass | action_dispatch.signed_cookie_digest | NilClass | action_dispatch.cookies_serializer | Symbol | action_dispatch.cookies_digest | NilClass | action_dispatch.cookies_rotations | ActiveSupport::Messages::RotationConfiguration | action_dispatch.cookies_same_site_protection | Proc | action_dispatch.use_cookies_with_metadata | TrueClass | action_dispatch.content_security_policy | NilClass | action_dispatch.content_security_policy_report_only | FalseClass | action_dispatch.content_security_policy_nonce_generator | NilClass | action_dispatch.content_security_policy_nonce_directives | NilClass | action_dispatch.permissions_policy | NilClass | action_dispatch.routes | ActionDispatch::Routing::RouteSet | ROUTES_14080_SCRIPT_NAME | String | ORIGINAL_FULLPATH | String | ORIGINAL_SCRIPT_NAME | String | action_dispatch.authorized_host | String | action_dispatch.request_id | String | action_dispatch.remote_ip | ActionDispatch::RemoteIp::GetIp | rack.session | ActionDispatch::Request::Session | rack.session.options | ActionDispatch::Request::Session::Options | rack.tempfiles |  | action_dispatch.request.path_parameters | controller | String | action | String | gem | String | version | String | guide | String | format | String | action_controller.instance | GemsController | action_dispatch.request.content_type | NilClass | action_dispatch.request.request_parameters |  | rack.request.query_string | String | rack.request.query_hash |  | action_dispatch.request.query_parameters |  | action_dispatch.request.parameters | controller | String | action | String | gem | String | version | String | guide | String | format | String | action_dispatch.request.formats |  | rack.request.cookie_hash | _gemsh_session | String | _skillit_session | String | token | String | rack.request.cookie_string | String | action_dispatch.cookies | ActionDispatch::Cookies::CookieJar | action_dispatch.request.unsigned_session_cookie | session_id | String | _csrf_token | String | flash | discard |  | flashes | notice | String | rack.version | Integer | rack.errors | IO | rack.multithread | TrueClass | rack.multiprocess | FalseClass | rack.run_once | FalseClass | rack.url_scheme | String | SCRIPT_NAME | String | QUERY_STRING | String | SERVER_SOFTWARE | String | GATEWAY_INTERFACE | String | REQUEST_METHOD | String | REQUEST_PATH | String | REQUEST_URI | String | SERVER_PROTOCOL | String | HTTP_HOST | String | HTTP_SEC_FETCH_SITE | String | HTTP_ACCEPT_ENCODING | String | HTTP_COOKIE | String | HTTP_CONNECTION | String | HTTP_SEC_FETCH_MODE | String | HTTP_ACCEPT | String | HTTP_USER_AGENT | String | HTTP_REFERER | String | HTTP_SEC_FETCH_DEST | String | HTTP_ACCEPT_LANGUAGE | String | puma.request_body_wait | Float | SERVER_NAME | String | SERVER_PORT | String | PATH_INFO | String | REMOTE_ADDR | String | HTTP_VERSION | String | puma.socket | TCPSocket | rack.hijack? | TrueClass | rack.hijack | Puma::Client | rack.input | Puma::NullIO | rack.after_reply |  | puma.config | Puma::Configuration | action_dispatch.parameter_filter | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | Symbol | action_dispatch.redirect_filter |  | action_dispatch.secret_key_base | String | action_dispatch.show_exceptions | TrueClass | action_dispatch.show_detailed_exceptions | TrueClass | action_dispatch.log_rescued_responses | TrueClass | action_dispatch.logger | ActiveSupport::Logger | action_dispatch.backtrace_cleaner | Rails::BacktraceCleaner | action_dispatch.key_generator | ActiveSupport::CachingKeyGenerator | action_dispatch.http_auth_salt | String | action_dispatch.signed_cookie_salt | String | action_dispatch.encrypted_cookie_salt | String | action_dispatch.encrypted_signed_cookie_salt | String | action_dispatch.authenticated_encrypted_cookie_salt | String | action_dispatch.use_authenticated_cookie_encryption | TrueClass | action_dispatch.encrypted_cookie_cipher | NilClass | action_dispatch.signed_cookie_digest | NilClass | action_dispatch.cookies_serializer | Symbol | action_dispatch.cookies_digest | NilClass | action_dispatch.cookies_rotations | ActiveSupport::Messages::RotationConfiguration | action_dispatch.cookies_same_site_protection | Proc | action_dispatch.use_cookies_with_metadata | TrueClass | action_dispatch.content_security_policy | NilClass | action_dispatch.content_security_policy_report_only | FalseClass | action_dispatch.content_security_policy_nonce_generator | NilClass | action_dispatch.content_security_policy_nonce_directives | NilClass | action_dispatch.permissions_policy | NilClass | action_dispatch.routes | ActionDispatch::Routing::RouteSet | ROUTES_14080_SCRIPT_NAME | String | ORIGINAL_FULLPATH | String | ORIGINAL_SCRIPT_NAME | String | action_dispatch.authorized_host | String | action_dispatch.request_id | String | action_dispatch.remote_ip | ActionDispatch::RemoteIp::GetIp | rack.session | ActionDispatch::Request::Session | rack.session.options | ActionDispatch::Request::Session::Options | rack.tempfiles |  | action_dispatch.request.path_parameters | controller | String | action | String | gem | String | version | String | action_controller.instance | GemsController | action_dispatch.request.content_type | NilClass | action_dispatch.request.request_parameters |  | rack.request.query_string | String | rack.request.query_hash |  | action_dispatch.request.query_parameters |  | action_dispatch.request.parameters | controller | String | action | String | gem | String | version | String | action_dispatch.request.accepts |  | action_dispatch.request.formats |  | rack.request.cookie_hash | _gemsh_session | String | _skillit_session | String | token | String | rack.request.cookie_string | String | action_dispatch.cookies | ActionDispatch::Cookies::CookieJar | action_dispatch.request.unsigned_session_cookie | session_id | String | _csrf_token | String | flash | discard |  | flashes | notice | String) env) -> (Hash | X-Frame-Options | String | X-XSS-Protection | String | X-Content-Type-Options | String | X-Download-Options | String | X-Permitted-Cross-Domain-Policies | String | Referrer-Policy | String | Link | String | Content-Type | String | ActionDispatch::Response::RackBody | Hash | X-Frame-Options | String | X-XSS-Protection | String | X-Content-Type-Options | String | X-Download-Options | String | X-Permitted-Cross-Domain-Policies | String | Referrer-Policy | String | Link | String | Content-Type | String | Vary | String | ActionDispatch::Response::RackBody)

This signature was generated using 3 samples from 1 application.

def call(env)
  @file_handler.attempt(env) || @app.call(env)
end

def initialize(app, path, index: "index", headers: {})

def initialize(app, path, index: "index", headers: {})
  @app = app
  @file_handler = FileHandler.new(path, index: index, headers: headers)
end