Feature request: X-Sendfile (apache) and X-Accel-Redirect (nginx) support

Viewing 1 post (of 1 total)
#165460

mike mike
Participant

References:

Offering this as an option instead of using readfile() or fopen() or some other file wrappers offloads the transfer to the webserver and releases PHP. This has been around for years and is a game changer for resource utilization.

It’s pretty simple really, you’d just modify the (misspelled) method donwloadFile() and check for an option of nginx x-accel-redirect or apache xsendfile, and simply pass this for nginx:
header('X-Accel-Redirect: /relative/to/document/root'); return;
or for apache:
header('X-Sendfile: /relative/to/document/root'); return;
and that should basically be it. tidy up the stuff that doesn’t _need_ to fire, of course (other headers that are no longer needed) or put this up higher in the function after the required headers are sent.

Viewing 1 post (of 1 total)

The topic ‘Feature request: X-Sendfile (apache) and X-Accel-Redirect (nginx) support’ is closed to new replies.