Secure urls with file storage backend

Would anyone happen to know of a way to generate secure url’s eg expiring or single.
But for the file storage backend? So far i can only find this for S3 buckets.
Any pointers would be most welcome.

Thanks
Andrew

I don’t think there is anything like that right now, the usual pattern is to use the parent object (the ruby object your attacher is bound to) to handle that part of the request, so instead of linking directly to https://example.com/uploads/your_file.jpg, you would link to https://example.com/avatars/123.jpg, and have your AvatarsController work out (through Devise/CanCanCan|Pundit) what to do with that request.

Walter

Thanks thought this might be the case.
Will look at doing this via the controller so i can put the files outside of public folder.

There is a download_endpoint plugin that can be used in conjunction with a controller where the controller will handle the authorization/expiration of the url. This may make sense or not depending on what kind of url’s you want to have e.g. urls like above together with a token or a one-time unique url. I haven’t used it so I’m not familiar with the implementation details.

It would probably be useful to add expiration/signature functionality to download_endpoint plugin.

Thanks yes this is what i ended up using, with my own auth code added to the controller for it.

@janko That’s true it could be useful.