Greg Hauptmann
2009-Sep-23 09:55 UTC
how can I use Apache to serve static content for a RoR app when I have only .htaccess access (and can''t add Apache modules) [on Dreamhost shared server]
Hi, Are there any Rails/Apache guru''s that might know if it''s possible (and how) to have the ability for users to upload their content to my RoR application but then subsequent access to such static content would be: a) served by APACHE web server [to avoid the overhead of going via Rails], but b) still want to have an authentication/authorisation check to occur before they can access the content The constraint is I''m on http://dreamhost.com/ shared platform where I have only access to the Apache .htaccess file and I can''t add my own Apache modules. http://wiki.dreamhost.com/Apache http://wiki.dreamhost.com/Htaccess http://wiki.dreamhost.com/KB_/_Unix_/_.htaccess_files thanks
Greg Hauptmann
2009-Sep-24 20:52 UTC
Re: how can I use Apache to serve static content for a RoR app when I have only .htaccess access (and can''t add Apache modules) [on Dreamhost shared server]
(bump - still really interested in response if someone is knowable in this area) 2009/9/23 Greg Hauptmann <greg.hauptmann.ruby-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> Hi, > > Are there any Rails/Apache guru''s that might know if it''s possible > (and how) to have the ability for users to upload their content to my > RoR application but then subsequent access to such static content > would be: > > a) served by APACHE web server [to avoid the overhead of going via > Rails], but > b) still want to have an authentication/authorisation check to > occur before they can access the content > > The constraint is I''m on http://dreamhost.com/ shared platform where I > have only access to the Apache .htaccess file and I can''t add my own > Apache modules. > > http://wiki.dreamhost.com/Apache > http://wiki.dreamhost.com/Htaccess > http://wiki.dreamhost.com/KB_/_Unix_/_.htaccess_files > > > > > thanks >-- Greg http://blog.gregnet.org/
daphonz
2009-Sep-25 13:52 UTC
Re: how can I use Apache to serve static content for a RoR app when I have only .htaccess access (and can''t add Apache modules) [on Dreamhost shared server]
Greg, It sounds like you have a contradicting desire here. You say you want the uploads to be served directly by the Apache server (so you don''t have Rails touching it), but you still want some form of authentication to make sure people can access it (which I imagine is what your Rails app is doing). The overhead from processing a Rails request is quite minimal, especially is you''re just doing some sort of user authentication and not some complex query/data gathering. My recommendation would be to use something like Paperclip (http://www.thoughtbot.com/projects/ paperclip) to help you upload files to your webserver, but protect access by serving the files through a Rails controller (something like this: http://www.therailsway.com/2009/2/22/file-downloads-done-right). And again, if you''re really, really concerned about your server overhead (like you''ll be getting tens of thousands of requests per hour), you can always move some of this logic into Rails Metal to decrease the overhead, but, again, it''s unlikely that you''ll need to do so. -Casey On Sep 24, 4:52 pm, Greg Hauptmann <greg.hauptmann.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> (bump - still really interested in response if someone is knowable in this area) > > 2009/9/23 Greg Hauptmann <greg.hauptmann.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > > > > > > Hi, > > > Are there any Rails/Apache guru''s that might know if it''s possible > > (and how) to have the ability for users to upload their content to my > > RoR application but then subsequent access to such static content > > would be: > > > a) served by APACHE web server [to avoid the overhead of going via > > Rails], but > > b) still want to have an authentication/authorisation check to > > occur before they can access the content > > > The constraint is I''m onhttp://dreamhost.com/shared platform where I > > have only access to the Apache .htaccess file and I can''t add my own > > Apache modules. > > > http://wiki.dreamhost.com/Apache > > http://wiki.dreamhost.com/Htaccess > > http://wiki.dreamhost.com/KB_/_Unix_/_.htaccess_files > > > thanks > > -- > Greghttp://blog.gregnet.org/
Greg Hauptmann
2009-Sep-25 17:53 UTC
Re: how can I use Apache to serve static content for a RoR app when I have only .htaccess access (and can''t add Apache modules) [on Dreamhost shared server]
thanks Casey - you no doubt correct :) I''ll run with your suggested ''don''t over-engineer'' concept... 2009/9/25 daphonz <cdreier-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > Greg, > > It sounds like you have a contradicting desire here. You say you want > the uploads to be served directly by the Apache server (so you don''t > have Rails touching it), but you still want some form of > authentication to make sure people can access it (which I imagine is > what your Rails app is doing). > > The overhead from processing a Rails request is quite minimal, > especially is you''re just doing some sort of user authentication and > not some complex query/data gathering. My recommendation would be to > use something like Paperclip (http://www.thoughtbot.com/projects/ > paperclip) to help you upload files to your webserver, but protect > access by serving the files through a Rails controller (something like > this: http://www.therailsway.com/2009/2/22/file-downloads-done-right). > > And again, if you''re really, really concerned about your server > overhead (like you''ll be getting tens of thousands of requests per > hour), you can always move some of this logic into Rails Metal to > decrease the overhead, but, again, it''s unlikely that you''ll need to > do so. > > -Casey > > On Sep 24, 4:52 pm, Greg Hauptmann <greg.hauptmann.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: >> (bump - still really interested in response if someone is knowable in this area) >> >> 2009/9/23 Greg Hauptmann <greg.hauptmann.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: >> >> >> >> >> >> > Hi, >> >> > Are there any Rails/Apache guru''s that might know if it''s possible >> > (and how) to have the ability for users to upload their content to my >> > RoR application but then subsequent access to such static content >> > would be: >> >> > a) served by APACHE web server [to avoid the overhead of going via >> > Rails], but >> > b) still want to have an authentication/authorisation check to >> > occur before they can access the content >> >> > The constraint is I''m onhttp://dreamhost.com/shared platform where I >> > have only access to the Apache .htaccess file and I can''t add my own >> > Apache modules. >> >> > http://wiki.dreamhost.com/Apache >> > http://wiki.dreamhost.com/Htaccess >> > http://wiki.dreamhost.com/KB_/_Unix_/_.htaccess_files >> >> > thanks >> >> -- >> Greghttp://blog.gregnet.org/ > > > >-- Greg http://blog.gregnet.org/
Matt Jones
2009-Sep-25 18:46 UTC
Re: how can I use Apache to serve static content for a RoR app when I have only .htaccess access (and can''t add Apache modules) [on Dreamhost shared server]
Note that the X-Sendfile method in the linked article is only supported by an Apache module, which doesn''t appear to be installed on the default DH config. So you''re back where you started... I''d recommend contacting DH support - I''ve never worked with them, but the support at Site5 has always been willing to install gems / Apache modules that were standard. --Matt Jones On Sep 25, 1:53 pm, Greg Hauptmann <greg.hauptmann.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> thanks Casey - you no doubt correct :) I''ll run with your suggested > ''don''t over-engineer'' concept... > > 2009/9/25 daphonz <cdre...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > > > > > > > > Greg, > > > It sounds like you have a contradicting desire here. You say you want > > the uploads to be served directly by the Apache server (so you don''t > > have Rails touching it), but you still want some form of > > authentication to make sure people can access it (which I imagine is > > what your Rails app is doing). > > > The overhead from processing a Rails request is quite minimal, > > especially is you''re just doing some sort of user authentication and > > not some complex query/data gathering. My recommendation would be to > > use something like Paperclip (http://www.thoughtbot.com/projects/ > > paperclip) to help you upload files to your webserver, but protect > > access by serving the files through a Rails controller (something like > > this:http://www.therailsway.com/2009/2/22/file-downloads-done-right). > > > And again, if you''re really, really concerned about your server > > overhead (like you''ll be getting tens of thousands of requests per > > hour), you can always move some of this logic into Rails Metal to > > decrease the overhead, but, again, it''s unlikely that you''ll need to > > do so. > > > -Casey > > > On Sep 24, 4:52 pm, Greg Hauptmann <greg.hauptmann.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > > wrote: > >> (bump - still really interested in response if someone is knowable in this area) > > >> 2009/9/23 Greg Hauptmann <greg.hauptmann.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: > > >> > Hi, > > >> > Are there any Rails/Apache guru''s that might know if it''s possible > >> > (and how) to have the ability for users to upload their content to my > >> > RoR application but then subsequent access to such static content > >> > would be: > > >> > a) served by APACHE web server [to avoid the overhead of going via > >> > Rails], but > >> > b) still want to have an authentication/authorisation check to > >> > occur before they can access the content > > >> > The constraint is I''m onhttp://dreamhost.com/sharedplatform where I > >> > have only access to the Apache .htaccess file and I can''t add my own > >> > Apache modules. > > >> > http://wiki.dreamhost.com/Apache > >> > http://wiki.dreamhost.com/Htaccess > >> > http://wiki.dreamhost.com/KB_/_Unix_/_.htaccess_files > > >> > thanks > > >> -- > >> Greghttp://blog.gregnet.org/ > > -- > Greghttp://blog.gregnet.org/
Greg Hauptmann
2009-Sep-25 21:40 UTC
Re: how can I use Apache to serve static content for a RoR app when I have only .htaccess access (and can''t add Apache modules) [on Dreamhost shared server]
thanks Matt 2009/9/26 Matt Jones <al2o3cr-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>:> > Note that the X-Sendfile method in the linked article is only > supported by an Apache module, which doesn''t appear to be installed on > the default DH config. So you''re back where you started... > > I''d recommend contacting DH support - I''ve never worked with them, but > the support at Site5 has always been willing to install gems / Apache > modules that were standard. > > --Matt Jones > > On Sep 25, 1:53 pm, Greg Hauptmann <greg.hauptmann.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: >> thanks Casey - you no doubt correct :) I''ll run with your suggested >> ''don''t over-engineer'' concept... >> >> 2009/9/25 daphonz <cdre...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: >> >> >> >> >> >> >> >> > Greg, >> >> > It sounds like you have a contradicting desire here. You say you want >> > the uploads to be served directly by the Apache server (so you don''t >> > have Rails touching it), but you still want some form of >> > authentication to make sure people can access it (which I imagine is >> > what your Rails app is doing). >> >> > The overhead from processing a Rails request is quite minimal, >> > especially is you''re just doing some sort of user authentication and >> > not some complex query/data gathering. My recommendation would be to >> > use something like Paperclip (http://www.thoughtbot.com/projects/ >> > paperclip) to help you upload files to your webserver, but protect >> > access by serving the files through a Rails controller (something like >> > this:http://www.therailsway.com/2009/2/22/file-downloads-done-right). >> >> > And again, if you''re really, really concerned about your server >> > overhead (like you''ll be getting tens of thousands of requests per >> > hour), you can always move some of this logic into Rails Metal to >> > decrease the overhead, but, again, it''s unlikely that you''ll need to >> > do so. >> >> > -Casey >> >> > On Sep 24, 4:52 pm, Greg Hauptmann <greg.hauptmann.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> >> > wrote: >> >> (bump - still really interested in response if someone is knowable in this area) >> >> >> 2009/9/23 Greg Hauptmann <greg.hauptmann.r...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>: >> >> >> > Hi, >> >> >> > Are there any Rails/Apache guru''s that might know if it''s possible >> >> > (and how) to have the ability for users to upload their content to my >> >> > RoR application but then subsequent access to such static content >> >> > would be: >> >> >> > a) served by APACHE web server [to avoid the overhead of going via >> >> > Rails], but >> >> > b) still want to have an authentication/authorisation check to >> >> > occur before they can access the content >> >> >> > The constraint is I''m onhttp://dreamhost.com/sharedplatform where I >> >> > have only access to the Apache .htaccess file and I can''t add my own >> >> > Apache modules. >> >> >> > http://wiki.dreamhost.com/Apache >> >> > http://wiki.dreamhost.com/Htaccess >> >> > http://wiki.dreamhost.com/KB_/_Unix_/_.htaccess_files >> >> >> > thanks >> >> >> -- >> >> Greghttp://blog.gregnet.org/ >> >> -- >> Greghttp://blog.gregnet.org/ > > >-- Greg http://blog.gregnet.org/