Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve examples for X-Sendfile #115

Open
benoitbryon opened this issue Dec 22, 2015 · 0 comments
Open

Improve examples for X-Sendfile #115

benoitbryon opened this issue Dec 22, 2015 · 0 comments

Comments

@benoitbryon
Copy link
Collaborator

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant