Protect Django media files per user basis and also under NGINX

87 views
Skip to first unread message

Tal Bar-Or

unread,
Apr 19, 2021, 9:21:08 AM4/19/21
to Django users

Hello,

i have a project that create qrcode per user one to one relation, i discover that this media qr iame can be access if url is known .

Can somone please help me with best practice to Protect Django media files per user basis and also under NGINX for later production

Please advice

Thanks

Stats Student

unread,
Apr 20, 2021, 10:39:15 AM4/20/21
to django...@googlegroups.com
You should not map the URLs directly to your qrcode paths in Nginx, and instead use Django URLs to control the access. 

You can use Nginx’s X-Accel header functionality to redirect the user to the actual file without showing the real link. Google for “Using NGINX’s X-Accel with Remote URLs” on how to do that. 
You should also utilize expiring links for extra security. S3 supports expiring links but I’m sure others do, too.  





--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/cac7d1c4-f2df-4b94-9fa5-01260634afbbn%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages