Xsendfile - resulting in no Images?

Xsendfile - resulting in no Images?

by Josh Willcock -
Number of replies: 4
Picture of Core developers Picture of Plugin developers

Hello All,


Xsendfile has been added to apache and I have added the appropriate config file entries:

         $CFG->xsendfile = 'X-Sendfile';

        $CFG->xsendfilealiases = array(

          '/dataroot/' => '/mnt/efs/moodledata/',

          '/localcachedir/' => '/home/localcache',

          '/cachedir/' => '/mnt/efs/moodledata/cache',

                 '/tempdir/'  => '/mnt/efs/moodledata/temp',

                 '/filedir'   => '/mnt/efs/moodledata/filedir',

        );


However when enabling this I end up with no images - the other query is /filedir is the only option without a trailing slash in the alias array?


There appears to be no documentation on xsendfile other than that config-dist entry which really doesn't tell me very much. Using Apache on Ubuntu 16 - any advice appreciated?


Average of ratings: -
In reply to Josh Willcock

Re: Xsendfile - resulting in no Images?

by Chris Fryer -

I've not experimented with X-Sendfile, but I would expect trailing slashes to be on both sides of the map, or on neither. Does that help at all?

In reply to Josh Willcock

Re: Xsendfile - resulting in no Images?

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Josh,
good question about filedir, you could file a minor issue into the Tracker to cleanup it: it should affect the ability to serve the aliased directory.
BTW aliases affects nginx only.

What are the missing images? The one coming from the theme or from an activity?
What does your related Apache config look like e.g. XSendfilePath ?

HTH,
Matteo

In reply to Matteo Scaramuccia

Re: Xsendfile - resulting in no Images?

by Josh Willcock -
Picture of Core developers Picture of Plugin developers

Sorry for the delay, with two conferences I've been out of the office far too much recently!

I'll look at raising an issue in tracker to sort that out (just for consistency).

I'm using Apache at the moment and in the directory I have:

		XSendFilePath /home/moodle

At the moment it appears to be literally every image which suffers from this issue. I am not sure how the path should relate to the install (I assume to Moodle's root dir?) - So the Aliases are not required then, that would create an issue then I would imagine.
In reply to Josh Willcock

Re: Xsendfile - resulting in no Images?

by Matteo Scaramuccia -
Picture of Core developers Picture of Peer reviewers Picture of Plugin developers

Hi Josh,
I got your post out of my radar.

You need to expose both the wwwroot (i.e. the internal dirroot) and the dataroot full paths i.e.:

    <IfModule mod_xsendfile.c>
        XSendFile on

        XSendFilePath /path/to/moodle-code
        XSendFilePath /path/to/moodle-data
    </IfModule>

HTH,
Matteo