How can I serve the binary through the rack?

I think I am a little stupid here, but I keep getting errors complaining about the SERVER_NAME key not present in the env hash and I cannot find essential documentation on Rack :: SendFile ..

so how can i serve files?

+2


a source to share


1 answer


If you are uploading large files to upload, I would recommend that the web server serves up big data. This way, you are not wasting precious resources running the Rack application to allow the user to perform long loading times.



If you responded with a custom header ( X-Sendfile

for Apache, X-Accel-Redirect

for Nginx), the web server will use the content of the file specified as the body for the response. This will make your Rack application ready for the next request, while the web server takes care of the lengthy process of sending data to the user. You may need to enable this feature for your web server.

0


a source







All Articles