inveniosoftware / invenio-files-rest

REST API for uploading/downloading files for Invenio.
https://invenio-files-rest.readthedocs.io
MIT License
9 stars 68 forks source link

global: serving using X-SENDFILE #82

Open jirikuncar opened 8 years ago

jirikuncar commented 8 years ago

@jirikuncar commented on Fri Sep 18 2015

Is there any interest on having this feature implemented here? @inveniosoftware/triagers

tiborsimko commented 8 years ago

It would be definitely useful regarding scalability. Otherwise, serving files from the Python app directly, would basically mean blocking one WSGI worker process until the file transfer is over... This could make the whole system unresponsive in the case of user storms or when transferring really big files.

lnielsen commented 8 years ago

Should be pretty easy to implement: https://github.com/pallets/flask/blob/master/flask/helpers.py#L516-L521

And we should just rely on Flask's default behaviour with USE_X_SENDFILE.

We are however recommending using Nginx today (via our docker recipes), and Nginx uses X-Accel-Redirect instead of X-Sendfile: https://www.nginx.com/resources/wiki/start/topics/examples/xsendfile/#