Secure static media access in a Django site

前端 未结 2 1496
遥遥无期
遥遥无期 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:18

    The usual way to do this is to pass back a special header to the web server.

    You can do it with nginx using x-accel-redirect as in this Django snippet.

    For Apache, it should be pretty similar using the mod_xsendfile module (discussion and examples on Django users mailing list).

提交回复
热议问题