Secure static media access in a Django site

前端 未结 2 1494
遥遥无期
遥遥无期 2021-01-31 05:50

I\'m building a site where registered users can upload files. Those files are then served via Apache. Only users who are logged in should be able to access those files.

2条回答
  •  清酒与你
    2021-01-31 06:41

    If you have freedom to switch from Apache to lighttpd, then the most straightforward solution would be to use mod_secdownload which would do exactly what you want, that is, provide application authentication while serving the actual files via web server.

    However if you are stuck with Apache, then I suggest mod_auth_token, here they mention PHP but you can generate the token in Python or any other language. Using mod_auth_token you will be able to generate the token in your application, and then have web server serve the static file utilizing that token.

提交回复
热议问题