2

I am using Django on Apache with mod_wsgi. I would like to use X-Sendfile for sending files, but with fallback when the X-Sendfile is not available.

Is there any way to list loaded Apache modules or to check whether the X-Sendfile is enabled or not directly from Django? I tried to dump the request variable, but there's no such information.

Viktor Stískala
  • 1,447
  • 1
  • 13
  • 23

1 Answers1

1

Add into Apache configuration:

<IfModule mod_xsendfile.c>
Setenv apache.modules.mod_xsendfile On
</IfModule>

The request meta variables, ie., WSGI environ dictionary, would then have an entry for 'apache.modules.mod_xsendfile' with value 'On'. You can check for presence of variable and modify behaviour accordingly.

Graham Dumpleton
  • 57,726
  • 6
  • 119
  • 134