Server IP : 66.29.132.122 / Your IP : 13.58.72.59 Web Server : LiteSpeed System : Linux business142.web-hosting.com 4.18.0-553.lve.el8.x86_64 #1 SMP Mon May 27 15:27:34 UTC 2024 x86_64 User : admazpex ( 531) PHP Version : 7.2.34 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /proc/self/root/proc/self/root/proc/thread-self/root/proc/thread-self/root/opt/alt/ruby21/lib64/ruby/gems/2.1.0/doc/rack-1.6.4/ri/Rack/Static/ |
Upload File : |
U:RDoc::NormalClass[iI"Static:ETI"Rack::Static;TI"Object;To:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[ I"FThe Rack::Static middleware intercepts requests for static files ;TI"O(javascript files, images, stylesheets, etc) based on the url prefixes or ;TI"Nroute mappings passed in the options, and serves them using a Rack::File ;TI"Oobject. This allows a Rack stack to serve both static and dynamic content.;To:RDoc::Markup::BlankLine o; ;[I"Examples:;T@o; ;[I"NServe all requests beginning with /media from the "media" folder located ;TI"+in the current directory (ie media/*):;T@o:RDoc::Markup::Verbatim;[I"+use Rack::Static, :urls => ["/media"] ;T:@format0o; ;[I"PServe all requests beginning with /css or /images from the folder "public" ;TI"Din the current directory (ie public/css/* and public/images/*):;T@o;;[I"Guse Rack::Static, :urls => ["/css", "/images"], :root => "public" ;T;0o; ;[I"OServe all requests to / with "index.html" from the folder "public" in the ;TI".current directory (ie public/index.html):;T@o;;[I"Iuse Rack::Static, :urls => {"/" => 'index.html'}, :root => 'public' ;T;0o; ;[I"IServe all requests normally from the folder "public" in the current ;TI";directory but uses index.html as default route for "/";T@o;;[I"Cuse Rack::Static, :urls => [""], :root => 'public', :index => ;TI"'index.html' ;T;0o; ;[I"0Set custom HTTP Headers for based on rules:;T@o;;[4I"- use Rack::Static, :root => 'public', ;TI" :header_rules => [ ;TI"J [rule, {header_field => content, header_field => content}], ;TI"0 [rule, {header_field => content}] ;TI" ] ;TI" ;TI" Rules for selecting files: ;TI" ;TI"1) All files ;TI" Provide the :all symbol ;TI"# :all => Matches every file ;TI" ;TI"2) Folders ;TI", Provide the folder path as a string ;TI"N '/folder' or '/folder/subfolder' => Matches files in a certain folder ;TI" ;TI"3) File Extensions ;TI"0 Provide the file extensions as an array ;TI"K ['css', 'js'] or %w(css js) => Matches files ending in .css or .js ;TI" ;TI"%4) Regular Expressions / Regexp ;TI"% Provide a regular expression ;TI"B %r{\.(?:css|js)\z} => Matches files ending in .css or .js ;TI"H /\.(?:eot|ttf|otf|woff2|woff|svg)\z/ => Matches files ending in ;TI"S the most common web font formats (.eot, .ttf, .otf, .woff2, .woff, .svg) ;TI"N Note: This Regexp is available as a shortcut, using the :fonts rule ;TI" ;TI"5) Font Shortcut ;TI"" Provide the :fonts symbol ;TI"_ :fonts => Uses the Regexp rule stated right above to match all common web font endings ;TI" ;TI"Rule Ordering: ;TI"> Rules are applied in the order that they are provided. ;TI"5 List rather general rules above special ones. ;TI" ;TI"<Complete example use case including HTTP header rules: ;TI" ;TI"- use Rack::Static, :root => 'public', ;TI" :header_rules => [ ;TI"K # Cache all static files in public caches (e.g. Rack::Cache) ;TI"+ # as well as in the browser ;TI"G [:all, {'Cache-Control' => 'public, max-age=31536000'}], ;TI" ;TI"K # Provide web fonts with cross-origin access-control-headers ;TI"\ # Firefox requires this when serving assets using a Content Delivery Network ;TI"? [:fonts, {'Access-Control-Allow-Origin' => '*'}] ;TI" ];T;0: @fileI"lib/rack/static.rb;T:0@omit_headings_from_table_of_contents_below0; 0;0[ [ [ [[I" class;T[[:public[[I"new;TI"lib/rack/static.rb;T[:protected[ [:private[ [I" instance;T[[;[ [I"applicable_rules;F@u[I" call;F@u[I"can_serve;F@u[I"overwrite_file_path;F@u[I"route_file;F@u[;[ [;[ [ [U:RDoc::Context::Section[i 0o;;[ ; 0;0[@iI" Rack;FcRDoc::NormalModule