Proxy files through application. This avoids having a redirect and makes files easier to cache.
WARNING: All Active Storage controllers are publicly accessible by default. The generated URLs are hard to guess, but permanent by design. If your files require a higher level of protection consider implementingAuthenticated Controllers.
Methods
- S
Included Modules
Instance Public methods
show()Link
# File activestorage/app/controllers/active_storage/blobs/proxy_controller.rb, line 14defshowifrequest.headers["Range"].present?send_blob_byte_range_data@blob,request.headers["Range"]elsehttp_cache_foreverpublic:truedoresponse.headers["Accept-Ranges"] ="bytes"response.headers["Content-Length"] =@blob.byte_size.to_ssend_blob_stream@blob,disposition:params[:disposition]endendend