This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# app/helpers/application_helper.rb | |
module ApplicationHelper | |
# active_storage_item could be a blob or variant object | |
def proxy_url(active_storage_item, options = {}) | |
options.merge!(host: ENV['ASSETS_HOST']) if ENV['ASSETS_HOST'].present? | |
# proxy: 'true' allows you to stil have the original functionality while | |
# being able to proxy through a CDN. You've got to ensure that your CDN | |
# forwards this param otherwise active storage will always do the default | |
# behavior which is a redirect to the service. |