views:

127

answers:

3

Hello,

The task: Serve the files located in a local folder on the server to clients over http/80. In the end, I plan to emulate the folder on the client but that doesn't concern my question.

So, there is an existing Rails app (rest based/xml) on that server that the clients would use in conjunction with these files.

I don't need any logic to be done on the files either on upload or download so I ask myself:

  1. Do I need to involve my Rails app in serving these files?
  2. Shouldn't the webserver solely handle the link between the local files and the clients?
  3. Would this new Rails Metal or Rack integration be part of the solution? (not familiar with either)

I guess the important thing here is http over port 80.

Thanks for any pointers or advice on the matter, cheers, Max

I know that with the good time investment I could look all this up for a couple of hours and figure it out but I am very very busy saves me alot of time.

A: 

Put the files in a subdirectory of the "public" directory - as with stylesheets and javascripts

Noel Walters
sounds sexy. however I cant can't change my file's location but I'll keep this in mind, under linux I could easily sunc my files dir with the public dir. Here is windows though, i'll look into it. Thanks for the help.
ximus
A: 

you can use X-Sendfile if you are using Apache or Lighty (see this blog post). Nginx supports X-Accel-Redirect. Both of these approaches will let your web server directly send the file without involving your rails app.

_Kevin
+1  A: 

Apache? Just add another <Directory> section to your configuration for the Rails app:

Alias /static-files /path/to/the/static-files
<Directory /path/to/the/static-files>
    Order allow, deny
    Allow from all
    # whatever else you need, Options, AllowOverride, etc.
</Directory>
Steve Madsen