WebFaction
Community site: login faq

I have some problems to download files from my apps with Rails 3. I have 2 apps (Rails 3.0.3) : - One with config.action_dispatch.x_sendfile_header = "X-Sendfile" => it works - One other with config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' => it works too

The second doesn't work with the first config. But I use Nginx for the 2apps !?

I send files like this : return send_file RAILS_ROOT + "/#{path}", :filename => File.basename(path)

So, what is the right way ? I don't understand how it can works with the first config.

asked 11 Feb '11, 01:27

muqaddar
178
accept rate: 0%

Hi,

X-Sendfile is the header you should be using to send files to the user.

(11 Feb '11, 01:46) klynton

I tried that once, you have to modify the nginx.conf for come location settings, this is usually done to protect files and still have nginx serve the download, but you may find helpful info here:

http://andrewtimberlake.com/blog/how-to-protect-downloads-but-still-have-nginx-serve-the-files

permanent link

answered 27 Feb '11, 12:38

Phrozen
51159
accept rate: 40%

Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Question tags:

×22
×7

question asked: 11 Feb '11, 01:27

question was seen: 4,119 times

last updated: 27 Feb '11, 12:38

WEBFACTION
REACH US
SUPPORT
AFFILIATE PROGRAM
LEGAL
© COPYRIGHT 2003-2020 SWARMA LIMITED - WEBFACTION IS A SERVICE OF SWARMA LIMITED
REGISTERED IN ENGLAND AND WALES 5729350 - VAT REGISTRATION NUMBER 877397162
5TH FLOOR, THE OLD VINYL FACTORY, HAYES, UB3 1HA, UNITED KINGDOM