I want to use HTTPDownloadView to proxy to assets on the same domain.
This doesn't seem to be a conventional choice, but I don't like any of
the other views for my particular use case -- my django-downloadview's
are redirecting solely on the basis of requested url and I don't think
exposing the path or object id to end users would be ideal.
HTTPDownloadView passes it's url to the requests library, which
expects a fully qualified url. However, ProxiedDownloadMiddleware
depends upon that url being the same one in DOWNLOADVIEW_RULES. So in
order to use HTTPDownloadView, DOWNLOAD_RULES must also contain
fully qualified urls. I don't like this option much because I'd have to
modify DOWNLOAD_RULES at startup time to account for different
environments (dev, staging, production, etc).
The solution I propose is to construct a fully qualified url to pass to
requests while leaving the file.url relative.
It would be nice to add a test for this but it isn't obvious to me where it should go and I wont bother if the proposal is rejected.
I want to use
HTTPDownloadView
to proxy to assets on the same domain. This doesn't seem to be a conventional choice, but I don't like any of the other views for my particular use case -- my django-downloadview's are redirecting solely on the basis of requested url and I don't think exposing the path or object id to end users would be ideal.HTTPDownloadView
passes it's url to therequests
library, which expects a fully qualified url. However,ProxiedDownloadMiddleware
depends upon that url being the same one inDOWNLOADVIEW_RULES
. So in order to useHTTPDownloadView
,DOWNLOAD_RULES
must also contain fully qualified urls. I don't like this option much because I'd have to modifyDOWNLOAD_RULES
at startup time to account for different environments (dev, staging, production, etc).The solution I propose is to construct a fully qualified url to pass to requests while leaving the
file.url
relative.It would be nice to add a test for this but it isn't obvious to me where it should go and I wont bother if the proposal is rejected.