I need to avoid to download media file from storj every time, if this file already on web server.
I use nginx which serves media. I need nginx check if file exists on server or not.
May be storj already has own solutions?
User requests http://mysite/file.txt. We download it from storj to /media folder and show to user.
User requests http://mysite/file.txt second time. We show it from webserver ( from /media folder)
Using nginx as a caching proxy should do this. I have not done this myself but happened to be researching it this morning.
Setup storj s3 gateway
Setup nginx to proxy requests to the gateway (this may be confusing because you’ll be connecting to localhost, proxying connections to localhost, don’t configure nginx to listen on the same port the storj s3 gateway is listening on and pay attention to port numbers and you’ll be ok.)
Mount your storage using the nginx proxy address (not the storj gateway)