Skip to content

Improve examples for X-Sendfile #115

Open
@benoitbryon

Description

@benoitbryon

In documentation:

  • examples for X-Sendfile are not clear (include directive references wrong code)
  • what URL middlewares catches and what URL it passes as X-Senfile header should be explained.

As an example:

  • given settings.MEDIA_URL = '/media/'
  • given a model with file = models.FileField(upload_to='documents'). It will have file.url prefixed with MEDIA_URL and UPLOAD_TO, i.e. /media/documents/ in our example.
  • given source_url is "/media/documents/", middleware will catch DownloadResponse where file.url starts with "/media/documents/", such as "/media/documents/sample-filename.pdf" => middleware will send "/sample-filename.pdf" to x-sendfile
  • given destination_url is "/var/lib/media/documents" (notice no trailing backslash) => x-sendfile value will be /var/lib/media/documents/sample-filename.txt
  • in general, destination_url should match one value configured as XSendFilePath in Apache configuration.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions