How to hide Rails active storage blob URL?

Viewed 115

I am using S3 for my Rails storage to upload a document that users are then rendering into their browser. However, one thing that I'm not completely sure I like is the fact that the URL to the storage path is directly visible in the browser.

For example, when the user requests an item that is located in S3, Rails redirects the user to the S3 URL. The only thing I don't really like about this is the fact that it tells the user I'm using S3 and presents an opportunity for some additional poking around and snooping.

Is there any way I could simply hide all of my rendered storage items behind my actual domain? Is this something I can do with Rails or do I have to do some other kind of configuration on the server side?

1 Answers

You can try the following:

send_data @entity.file.download, filename: @entity.file.blob.filename, type: @entity.file.blob.content_type, disposition: 'download'

this will not expose the blob URL even for disposition: 'inline'

Related