Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6998093
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T20:22:02+00:00 2026-05-27T20:22:02+00:00

I am using Heroku and Amazon S3, for storage. I’m trying to make the

  • 0

I am using Heroku and Amazon S3, for storage.

I’m trying to make the download dialogue appear for the audio file, instead of the browser playing it.

In one of my controllers, I have:

response.content_type = 'application/octet-stream'
response.headers['Content-Disposition'] = "attachment; filename=@audio.filename"
response.headers['X-Accel-Redirect'] = @audio.encoded_file_url
render :nothing => true

@audio.encoded_file_url returns http://bucket_name.s3.amazonaws.com/uploads/19/test.mp3.

Which seems to work on my local machine. However, I am wondering if this approach will block an entire HTTP request handler, freezing the app until the download completes.

In Heroku, a HTTP request handler is one Dyno. And having several Dynos is expensive.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T20:22:03+00:00Added an answer on May 27, 2026 at 8:22 pm

    I’m not sure that you can rely on nginx being used (X-Accel-Redirect is an nginx-ism) – the heroku docs imply that it’s not always used.

    In addition, X-Accel-Redirect is, to my knowledge only for redirecting to files actually on the server, not for externally hosted files. Why not do a normal redirect to the S3 hosted file (using an authenticated URL if needed) ?

    If you need to set headers like content disposition, this can be done either at time of upload or afterwards. If you use fog to do your s3 business you could do it like this (assuming storage is a Fog::Storage object)

    storage.copy_object("your_bucket", "filename","your_bucket","filename", "x-amz-metadata-directive" => 'REPLACE', 'Content-Disposition' => '...')
    

    Note that this overwrites all the metadata – if you have other fields such as Content-Type, Cache-Control etc. then make sure to set them here or they will be lost.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm trying to get Heroku working with European buckets on amazon s3 webserivces using
I am using Heroku to make a php application on Facebook. I want to
I'm trying to make an image of a graph using ruby-graphviz by @graph.output(:output =>
using heroku, I'm trying to update a record. This is what I did: @user
How should my database.yml production look like when I am using Heroku and Amazon
I am using Heroku bamboo-mri-1.9.2 with Amazon RDS database. My app do crash on
I'm using amazon rds with a heroku app and would like to automate daily
I'm setting up a new instance of a Rails(2.3.5) app on Heroku using Amazon
I'm using heroku as my host..It was working fine. Then I installed action_mailer_tls and
I would like to have different applications under the same domain using Heroku. Because

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.