class AssetManagerRedirectController < ApplicationController
  def show
    asset_url = Plek.new.public_asset_host
    if request.host.start_with?('draft-')
      asset_url = Plek.new.external_url_for('draft-assets')
    end

    redirect_to host: URI.parse(asset_url).host
  end
end

class AssetManagerRedirectController < ApplicationController
  def show
    asset_url = Plek.new.public_asset_host
    if request.host.start_with?('draft-')
      asset_url = Plek.new.external_url_for('draft-assets')
    end

    redirect_to host: URI.parse(asset_url).host, status: 301
  end
end

Use 301s rather than 302s for attachments
Use 301s rather than 302s for attachments

All the Whitehall attachments have been migrated to Asset Manager,
permanently.  We're not going to switch back, so we should reflect
this in the status code.
