관리-도구
편집 파일: 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