Django as S3 proxy

前端 未结 2 439
小蘑菇
小蘑菇 2021-01-02 23:06

I extended a ModelAdmin with a custom field \"Download file\", which is a link to a URL in my Django project, like:

http://www.myproject.com/downloads/1
         


        
2条回答
  •  囚心锁ツ
    2021-01-02 23:37

    Rather than proxying, why not simply redirect?

    Use the django view at www.myproject.com/downloads/1 to serve a HTTP Redirect to the S3 storage URL - it's possible to generate time-limited authenticated URLs e.g. see here https://docs.aws.amazon.com/AmazonS3/latest/dev/ShareObjectPreSignedURL.html

    Then the client downloads the file directly from S3, but the contents is still secure and access has to come through your Django application

提交回复
热议问题