question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

django-tenants with nginx x-accel-redirects

See original GitHub issue

I am trying to implement secured downloads for my tenants.

The following links are/might be relevant:

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:closed
  • Created 2 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
tomturnercommented, Aug 21, 2021

I wouldn’t recommend it if it didn’t work with DT

0reactions
hanckmanncommented, Aug 24, 2021

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

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found