Consultation request: feed local folder across rails (or not?)

Objective: serve files located in a local folder on the server to clients via http / 80. Eventually, I plan on emulating the folder on the client, but that doesn't address my question.

So, this server has an existing Rails application (rest based / xml) that clients will use in conjunction with these files.

I don't need any logic for the files being uploaded or uploaded, so I ask myself:

  • Do I need to involve a Rails application to work with these files?
  • Shouldn't the web server handle communication between local files and clients?
  • Will this new Rails Metal or Rack integration be part of the solution? (not familiar with any)

I think http over port 80 is more important here.

Thanks for any guidance or advice on this matter, cheers, Max

I know that with a good investment of time I could watch it all for a couple of hours and figure it out, but I'm very busy, which saves a lot of time.

+1


a source to share


3 answers


Apache? Just add another section <Directory>

to your config for your Rails application:



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>

      

+1


a source


Place the files in a subdirectory of the "public" directory - as with styles and javascripts



0


a source


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

0


a source







All Articles