django-tenants with nginx x-accel-redirects
See original GitHub issueI am trying to implement secured downloads for my tenants.
The following links are/might be relevant:
- https://djangosnippets.org/snippets/491/
- https://wellfire.co/learn/nginx-django-x-accel-redirects/
- https://www.digitalocean.com/community/questions/nginx-rule-for-wildcard-url
- https://django-tenants.readthedocs.io/en/latest/files.html#configuring-media-file-storage
I cannot claim to fully understand the nginx x-accel-redirects and their security implications. This is something I will dive deeper into later. First I need to understand how to get this to work with django-tenats.
The references discuss that a /protected/
folder (with whatever name) is used to store the files.
I assume that this folder must be present in the media folder of all tenants.
Also, how do I setup nginx such that this folder is found in each tenant’s media subfolder.
Can somebody provide any pointers, examples, etc to get this to work and such that I can understand this better?
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
How to Serve Protected Content With Django (Without ...
Using Nginx's X-Accel-Redirect you can apply permissions to files served directly by Nginx or combine Django and WordPress in the same URL paths....
Read more >Django and Nginx X-accel-redirect - Stack Overflow
2 Answers 2 · I prefer using the decorator, as it automatically redirects to the login page (when specified in settings) and sets...
Read more >How to Serve Protected Content using X-Accel ( Nginx + ...
Here I've used X-Accel redirect feature of Nginx to serve the protected content after it has been authenticated by the back-end logic.
Read more >[Blog post] Using Django and Nginx to hide URLs from user : r/django
Hey, I just wrote quick 2 blog post tutorial how to setup Django & Nginx to hide URLs from user using X-Accel-Redirect header....
Read more >nginx x-accel-redirect protection of static files - Django snippets
Nginx has the so called x-accel-redirect feature, that tells nginx to serve an internal (read 'protected') file if the backend response has ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I wouldn’t recommend it if it didn’t work with DT
Oke, I figured it out… it was a settings-issue that was holding me back.
and thanks for: https://github.com/edoburu/django-private-storage/pull/22