AlkantarClanX12
Current Path : /opt/alt/ruby26/lib64/ruby/gems/2.6.0/doc/rack-3.0.8/ri/Rack/Sendfile/ |
Current File : //opt/alt/ruby26/lib64/ruby/gems/2.6.0/doc/rack-3.0.8/ri/Rack/Sendfile/cdesc-Sendfile.ri |
U:RDoc::NormalClass[iI" Sendfile:ETI"Rack::Sendfile;TI"Object;To:RDoc::Markup::Document:@parts[o;;[)S:RDoc::Markup::Heading: leveli: textI" Sendfile;To:RDoc::Markup::BlankLine o:RDoc::Markup::Paragraph;[I"FThe Sendfile middleware intercepts responses whose body is being ;TI"Jserved from a file and replaces it with a server specific x-sendfile ;TI"Nheader. The web server is then responsible for writing the file contents ;TI"Mto the client. This can dramatically reduce the amount of work required ;TI"Pby the Ruby backend and takes advantage of the web server's optimized file ;TI"delivery code.;T@o; ;[I"KIn order to take advantage of this middleware, the response body must ;TI"Jrespond to +to_path+ and the request must include an x-sendfile-type ;TI"Mheader. Rack::Files and other components implement +to_path+ so there's ;TI"Mrarely anything you need to do in your application. The x-sendfile-type ;TI"Nheader is typically set in your web servers configuration. The following ;TI"!sections attempt to document;T@S; ; i;I" Nginx;T@o; ;[I"ONginx supports the x-accel-redirect header. This is similar to x-sendfile ;TI"Jbut requires parts of the filesystem to be mapped into a private URL ;TI"hierarchy.;T@o; ;[I"LThe following example shows the Nginx configuration required to create ;TI"Ma private "/files/" area, enable x-accel-redirect, and pass the special ;TI"@x-sendfile-type and x-accel-mapping headers to the backend:;T@o:RDoc::Markup::Verbatim;[I"location ~ /files/(.*) { ;TI" internal; ;TI" alias /var/www/$1; ;TI"} ;TI" ;TI"location / { ;TI" proxy_redirect off; ;TI" ;TI"5 proxy_set_header Host $host; ;TI"< proxy_set_header X-Real-IP $remote_addr; ;TI"J proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; ;TI" ;TI"@ proxy_set_header x-sendfile-type x-accel-redirect; ;TI"A proxy_set_header x-accel-mapping /var/www/=/files/; ;TI" ;TI"2 proxy_pass http://127.0.0.1:8080/; ;TI"} ;T:@format0o; ;[ I"NNote that the x-sendfile-type header must be set exactly as shown above. ;TI"PThe x-accel-mapping header should specify the location on the file system, ;TI"Nfollowed by an equals sign (=), followed name of the private URL pattern ;TI"Kthat it maps to. The middleware performs a simple substitution on the ;TI"resulting path.;T@o; ;[I"SSee Also: https://www.nginx.com/resources/wiki/start/topics/examples/xsendfile;T@S; ; i;I" lighttpd;T@o; ;[I"MLighttpd has supported some variation of the x-sendfile header for some ;TI"Ntime, although only recent version support x-sendfile in a reverse proxy ;TI"configuration.;T@o;;[I"&$HTTP["host"] == "example.com" { ;TI"% proxy-core.protocol = "http" ;TI", proxy-core.balancer = "round-robin" ;TI" proxy-core.backends = ( ;TI" "127.0.0.1:8000", ;TI" "127.0.0.1:8001", ;TI" ... ;TI" ) ;TI" ;TI"/ proxy-core.allow-x-sendfile = "enable" ;TI"' proxy-core.rewrite-request = ( ;TI"6 "x-sendfile-type" => (".*" => "x-sendfile") ;TI" ) ;TI" } ;T;0o; ;[I"JSee Also: http://redmine.lighttpd.net/wiki/lighttpd/Docs:ModProxyCore;T@S; ; i;I"Apache;T@o; ;[I"Fx-sendfile is supported under Apache 2.x using a separate module:;T@o; ;[I"%https://tn123.org/mod_xsendfile/;T@o; ;[I"HOnce the module is compiled and installed, you can enable it using ;TI" XSendFile config directive:;T@o;;[I"2RequestHeader Set x-sendfile-type x-sendfile ;TI"/ProxyPassReverse / http://localhost:8001/ ;TI"XSendFile on ;T;0S; ; i;I"Mapping parameter;T@o; ;[ I"CThe third parameter allows for an overriding extension of the ;TI"Rx-accel-mapping header. Mappings should be provided in tuples of internal to ;TI"Oexternal. The internal values may contain regular expression syntax, they ;TI",will be matched with case indifference.;T: @fileI"lib/rack/sendfile.rb;T:0@omit_headings_from_table_of_contents_below0;0;0[ [ [ [[I" class;T[[:public[[I"new;TI"lib/rack/sendfile.rb;T[:protected[ [:private[ [I" instance;T[[;[[I" call;T@�[;[ [;[[I"map_accel_path;T@�[I"variation;T@�[ [U:RDoc::Context::Section[i 0o;;[ ;0;0[@}I" Rack;TcRDoc::NormalModule